9个文件已添加
2 文件已重命名
1 文件已复制
34个文件已修改
New file |
| | |
| | | <script setup> |
| | | import { defineProps } from 'vue'; |
| | | import OrderView from './order.vue' |
| | | import OrderInView from './orderIn.vue' |
| | | import OrderOutView from './orderOut.vue' |
| | | |
| | | const props = defineProps({ |
| | | ioModel: null |
| | | }) |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '订单' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div v-if="props.ioModel === 'in'"> |
| | | <OrderInView ioModel="in" /> |
| | | </div> |
| | | <div v-else-if="props.ioModel === 'out'"> |
| | | <OrderOutView ioModel="out" /> |
| | | </div> |
| | | <div v-else> |
| | | <OrderView /> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
copy from zy-asrs-admin/src/components/order/index.vue
copy to zy-asrs-admin/src/components/order/order/orderIn.vue
New file |
| | |
| | | <script setup> |
| | | import { getCurrentInstance, ref, computed, reactive, defineProps } from 'vue'; |
| | | import { useRouter } from "vue-router"; |
| | | import { get, post, postBlob } from '@/utils/request.js' |
| | | import { message, Modal } from 'ant-design-vue'; |
| | | import { globalState, logout } from '@/config.js'; |
| | | import EditView from './edit.vue' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import useTableSearch from '@/utils/tableUtils.jsx'; |
| | | import ShowOrderDetlComponent from '@/components/orderDetl/show.vue'; |
| | | import { |
| | | DownOutlined, |
| | | UploadOutlined, |
| | | DownloadOutlined, |
| | | } from "@ant-design/icons-vue"; |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const emit = defineEmits(['pageReload']) |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const props = defineProps({ |
| | | ioModel: null |
| | | }) |
| | | |
| | | const TABLE_KEY = 'table-order'; |
| | | let currentPage = 1; |
| | | let pageSize = 10; |
| | | const searchInput = ref("") |
| | | const editChild = ref(null) |
| | | const showOrderDetlChild = ref(null) |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | loading: false, |
| | | }); |
| | | |
| | | let tableData = ref([]); |
| | | getPage(); |
| | | |
| | | const { |
| | | getColumnSearchProps, |
| | | handleResizeColumn, |
| | | } = useTableSearch(); |
| | | |
| | | const columns = [ |
| | | { |
| | | title: formatMessage('db.man_order.order_no', '订单编号'), |
| | | dataIndex: 'orderNo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('orderNo'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order.order_time', '单据日期'), |
| | | dataIndex: 'orderTime', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('orderTime'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order.order_type', '单据类型'), |
| | | dataIndex: 'orderType$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('orderType$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order.order_settle', '单据状态'), |
| | | dataIndex: 'orderSettle$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('orderSettle$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order.ioPri', '优先级'), |
| | | dataIndex: 'ioPri', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('ioPri'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order.wave_no', '波次编号'), |
| | | dataIndex: 'waveNo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('waveNo'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order.status', '状态'), |
| | | dataIndex: 'status$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('status$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order.create_time', '添加时间'), |
| | | dataIndex: 'createTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order.create_by', '添加人员'), |
| | | dataIndex: 'createBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('createBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order.update_time', '修改时间'), |
| | | dataIndex: 'updateTime$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateTime$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order.update_by', '修改人员'), |
| | | dataIndex: 'updateBy$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('updateBy$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order.memo', '备注'), |
| | | dataIndex: 'memo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('memo'), |
| | | }, |
| | | |
| | | { |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 240, |
| | | }, |
| | | ]; |
| | | |
| | | 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() { |
| | | state.loading = true; |
| | | |
| | | let apiUrl = '/api/order/page'; |
| | | if (props.ioModel == 'in') { |
| | | apiUrl = '/api/order/in/page'; |
| | | } else if (props.ioModel == 'out') { |
| | | apiUrl = '/api/order/out/page'; |
| | | } |
| | | |
| | | post(apiUrl, { |
| | | current: currentPage, |
| | | pageSize: pageSize, |
| | | condition: searchInput.value, |
| | | }).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let data = result.data; |
| | | tableData.value = data; |
| | | |
| | | state.loading = false; |
| | | } 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/order/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 showDetl = (item) => { |
| | | showOrderDetlChild.value.openDetl = true; |
| | | showOrderDetlChild.value.orderId = item.id; |
| | | } |
| | | |
| | | const handleExport = async (intl) => { |
| | | postBlob('/api/order/export', { |
| | | ioModel: props.ioModel |
| | | }).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() |
| | | } |
| | | |
| | | const handleSyncOrderClick = (e) => { |
| | | if (e.key == 'import') { |
| | | importTemplate() |
| | | } else if (e.key == 'export') { |
| | | exportTemplate() |
| | | } |
| | | } |
| | | |
| | | const importTemplate = () => { |
| | | //导入模板 |
| | | } |
| | | |
| | | const exportTemplate = () => { |
| | | //模板导出 |
| | | postBlob('/api/order/exportTemplate', {}).then(result => { |
| | | const blob = new Blob([result.data], { type: 'application/vnd.ms-excel' }); |
| | | window.location.href = window.URL.createObjectURL(blob); |
| | | return true; |
| | | }) |
| | | } |
| | | |
| | | const fileList = ref([]); |
| | | const handleUploadChange = info => { |
| | | if (info.file.status !== 'uploading') { |
| | | // console.log(info.file, info.fileList); |
| | | } |
| | | if (info.file.status === 'done') { |
| | | let result = info.file.response; |
| | | if (result.code == 200) { |
| | | message.success(`${info.file.name} ${formatMessage('page.upload.success', '上传成功')}`); |
| | | getPage() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | } else if (info.file.status === 'error') { |
| | | message.error(`${info.file.name} file upload failed.`); |
| | | } |
| | | }; |
| | | |
| | | const channel = ref(null) |
| | | const channelList = ref(null); |
| | | channelQuery(); |
| | | function channelQuery() { |
| | | post('/api/cacheSite/channel/list', {}).then(resp => { |
| | | let result = resp.data; |
| | | if (result.data == null) { |
| | | return |
| | | } |
| | | |
| | | let tmp = [] |
| | | result.data.forEach((item) => { |
| | | tmp.push({ |
| | | label: item, |
| | | value: item |
| | | }) |
| | | }) |
| | | channelList.value = tmp; |
| | | |
| | | if (tmp.length > 0) { |
| | | let data = tmp[0] |
| | | channel.value = [data.value]; |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleGenerateWave = () => { |
| | | let orderIdList = []; |
| | | state.selectedRowKeys.forEach((id) => { |
| | | orderIdList.push(id) |
| | | }) |
| | | |
| | | if (orderIdList.length == 0) { |
| | | message.error(formatMessage("page.orderOut.mergeOrderOut.error", "请选择至少一条订单")); |
| | | return; |
| | | } |
| | | |
| | | post('/api/out/wave/generate', { |
| | | orderIds: orderIdList, |
| | | channels: channel.value |
| | | }).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | message.success(formatMessage('page.add.success', '成功')); |
| | | emit('pageReload', 'reload') |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '订单' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <EditView ref="editChild" @tableReload="handleTableReload" |
| | | :ioModel="ioModel == 'in' ? 1 : ioModel == 'out' ? 2 : null" /> |
| | | <div class="table-header"> |
| | | <div style="display: flex;"> |
| | | <div style="margin-right: 10px;"> |
| | | <a-input-search v-model:value="searchInput" :placeholder="formatMessage('page.input', '请输入')" |
| | | style="width: 200px;" @search="onSearch" /> |
| | | </div> |
| | | <div> |
| | | <a-select v-model:value="channel" :options="channelList" mode="multiple" |
| | | style="width: 100px;"></a-select> |
| | | <a-button @click="handleGenerateWave()">{{ formatMessage('common.generateWave', '生成波次') |
| | | }}</a-button> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="table-header-right"> |
| | | <a-dropdown> |
| | | <template #overlay> |
| | | <a-menu @click="handleSyncOrderClick"> |
| | | <a-menu-item key="import"> |
| | | <a-upload v-model:file-list="fileList" name="file" action="/api/order/upload" |
| | | @change="handleUploadChange" :showUploadList="false" :headers="{ |
| | | Authorization: globalState.token |
| | | }"> |
| | | <UploadOutlined /> |
| | | {{ formatMessage('page.order.import', '单据导入') }} |
| | | </a-upload> |
| | | </a-menu-item> |
| | | |
| | | <a-menu-item key="export"> |
| | | <DownloadOutlined /> |
| | | {{ formatMessage('page.order.export.template', '导出模板') }} |
| | | </a-menu-item> |
| | | </a-menu> |
| | | </template> |
| | | <a-button> |
| | | {{ formatMessage('page.order.sync', '单据同步') }} |
| | | <DownOutlined /> |
| | | </a-button> |
| | | </a-dropdown> |
| | | <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" |
| | | :loading="state.loading"> |
| | | <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="showDetl(record)">{{ formatMessage('page.order.orderDetl', |
| | | '订单明细') |
| | | }}</a-button> |
| | | <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> |
| | | |
| | | <ShowOrderDetlComponent ref="showOrderDetlChild" /> |
| | | |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | |
| | | list: tableData.value |
| | | }; |
| | | |
| | | post('/api/out/orderOut/merge', requestParam).then((resp) => { |
| | | post('/api/out/orderOut/merge/wave', requestParam).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | message.success(formatMessage('page.add.success', '出库成功')); |
| | |
| | | let idx = 0; |
| | | let colSpan = [] |
| | | tmp.forEach((item) => { |
| | | item.locs.forEach((val) => { |
| | | let dataTmp = JSON.parse(JSON.stringify(item)); |
| | | dataTmp.locId = val.locId; |
| | | dataTmp.locNo = val.locNo; |
| | | dataTmp.locDetlId = val.locDetlId; |
| | | dataTmp.anfme = val.anfme; |
| | | dataTmp.key = idx; |
| | | dataTmp.operationPort = defaultOperationPort; |
| | | |
| | | tableDataTmp.push(dataTmp); |
| | | }) |
| | | |
| | | let count = item.locs.length; |
| | | if (item.anfme > 0) { |
| | | |
| | | if (item.locs.length == 0) { |
| | | let dataTmp = JSON.parse(JSON.stringify(item)); |
| | | |
| | | dataTmp.locId = null; |
| | | dataTmp.locNo = null; |
| | | dataTmp.locDetlId = null; |
| | |
| | | |
| | | tableDataTmp.push(dataTmp); |
| | | count++; |
| | | } else { |
| | | let isused = item.anfme; |
| | | console.log(isused); |
| | | |
| | | for (let i = 0; i < item.locs.length; i++) { |
| | | if (isused == 0) { |
| | | break; |
| | | } |
| | | const val = item.locs[i]; |
| | | let dataTmp = JSON.parse(JSON.stringify(item)); |
| | | let anfme = isused - val.anfme > 0 ? val.anfme : isused; |
| | | isused -= anfme; |
| | | |
| | | dataTmp.locId = val.locId; |
| | | dataTmp.locNo = val.locNo; |
| | | dataTmp.locDetlId = val.locDetlId; |
| | | dataTmp.anfme = anfme; |
| | | dataTmp.key = idx; |
| | | dataTmp.operationPort = defaultOperationPort; |
| | | |
| | | tableDataTmp.push(dataTmp); |
| | | } |
| | | |
| | | colSpan[idx] = count |
| | | console.log(tableDataTmp); |
| | | |
| | | |
| | | if (isused > 0) { |
| | | let dataTmp = JSON.parse(JSON.stringify(item)); |
| | | dataTmp.locId = null; |
| | | dataTmp.locNo = null; |
| | | dataTmp.locDetlId = null; |
| | | dataTmp.anfme = isused; |
| | | dataTmp.key = idx; |
| | | dataTmp.operationPort = defaultOperationPort; |
| | | |
| | | tableDataTmp.push(dataTmp); |
| | | count++; |
| | | } |
| | | } |
| | | |
| | | colSpan[idx] = count; |
| | | idx += count; |
| | | }) |
| | | |
New file |
| | |
| | | <script setup> |
| | | import { ref, watch, 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 { formatMessage } from '@/utils/localeUtils.js'; |
| | | import useTableSearch from '@/utils/tableUtils.jsx'; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const TABLE_KEY = 'table-order-out-preview'; |
| | | |
| | | const emit = defineEmits(['closeParent', 'reload']) |
| | | |
| | | const { |
| | | getColumnSearchProps, |
| | | } = useTableSearch(); |
| | | |
| | | let currentOrder = ref(null); |
| | | let searchInput = ref(null); |
| | | let tableData = ref([]); |
| | | const operationPortList = ref([]) |
| | | const globalOperationPort = ref(null) |
| | | const open = ref(false); |
| | | const showWidth = ref("60%") |
| | | const records = ref([]) |
| | | const waveId = ref(null) |
| | | const loading = ref(false) |
| | | let tableDataValue = [] |
| | | let tableDataColSpan = [] |
| | | |
| | | const customColSpanProps = (index) => { |
| | | let count = tableDataColSpan[index]; |
| | | if (count == null) { |
| | | count = 0; |
| | | } |
| | | return { |
| | | rowSpan: count, |
| | | }; |
| | | } |
| | | |
| | | let columns = [ |
| | | { |
| | | title: formatMessage('db.man_order_detl.matnr', '商品编号'), |
| | | dataIndex: 'matnr', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('matnr'), |
| | | customCell: (_, index) => { |
| | | return customColSpanProps(index) |
| | | }, |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order_detl.batch', '批号'), |
| | | dataIndex: 'batch', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('batch'), |
| | | customCell: (_, index) => { |
| | | return customColSpanProps(index) |
| | | }, |
| | | }, |
| | | ]; |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | }); |
| | | const onSelectChange = selectedRowKeys => { |
| | | // console.log('selectedRowKeys changed: ', selectedRowKeys); |
| | | state.selectedRowKeys = selectedRowKeys; |
| | | }; |
| | | |
| | | const fieldList = []; |
| | | getColumns(); |
| | | //加载扩展字段 |
| | | async function getColumns() { |
| | | let fieldResp = await post('/api/matField/list', { |
| | | unique: 1, |
| | | }) |
| | | let fieldResult = fieldResp.data; |
| | | let tmp = 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, |
| | | customCell: (_, index) => { |
| | | return customColSpanProps(index) |
| | | }, |
| | | }) |
| | | |
| | | fieldList.push(item.name); |
| | | }) |
| | | |
| | | tmp.push({ |
| | | title: formatMessage('db.man_order_detl.anfme', '数量'), |
| | | dataIndex: 'anfme', |
| | | width: 140, |
| | | ellipsis: true, |
| | | fixed: 'right', |
| | | }) |
| | | |
| | | tmp.push({ |
| | | title: formatMessage('db.man_order_detl.locNo', '出库库位'), |
| | | dataIndex: 'locNo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | fixed: 'right', |
| | | }) |
| | | |
| | | tmp.push({ |
| | | title: formatMessage('db.man_order_detl.operationPort', '作业口'), |
| | | dataIndex: 'operationPort', |
| | | width: 140, |
| | | ellipsis: true, |
| | | fixed: 'right', |
| | | }) |
| | | |
| | | columns = tmp; |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | } |
| | | |
| | | async function getOperationPort() { |
| | | let resp = await post('/api/operationPort/list', {}) |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let data = result.data; |
| | | let tmp = [] |
| | | data.forEach((item) => { |
| | | tmp.push({ |
| | | label: item.flag, |
| | | value: item.id |
| | | }) |
| | | }) |
| | | operationPortList.value = tmp; |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | } |
| | | |
| | | watch(open, (newVal, oldVal) => { |
| | | if (newVal) { |
| | | handleOrderMergePreview() |
| | | } |
| | | }) |
| | | |
| | | const handleOk = () => { |
| | | let requestParam = { |
| | | waveId: waveId.value, |
| | | list: tableData.value |
| | | }; |
| | | |
| | | post('/api/out/orderOut/merge/wave', requestParam).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | message.success(formatMessage('page.add.success', '出库成功')); |
| | | open.value = false; |
| | | emit('closeParent', true) |
| | | emit('reload', true) |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleOrderMergePreview = async () => { |
| | | loading.value = true; |
| | | |
| | | await getOperationPort(); |
| | | tableData.value = [] |
| | | tableDataValue = [] |
| | | |
| | | let defaultOperationPort = ""; |
| | | if (operationPortList.value.length > 0) { |
| | | defaultOperationPort = operationPortList.value[0].value; |
| | | globalOperationPort.value = defaultOperationPort; |
| | | } |
| | | |
| | | post('/api/out/orderOut/wave/preview', { |
| | | waveId: waveId.value, |
| | | }).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let tmp = result.data; |
| | | tableDataValue = tmp; |
| | | |
| | | let tableDataTmp = [] |
| | | let idx = 0; |
| | | let colSpan = [] |
| | | tmp.forEach((item) => { |
| | | let count = item.locs.length; |
| | | |
| | | if (item.locs.length == 0) { |
| | | let dataTmp = JSON.parse(JSON.stringify(item)); |
| | | |
| | | dataTmp.locId = null; |
| | | dataTmp.locNo = null; |
| | | dataTmp.locDetlId = null; |
| | | dataTmp.anfme = item.anfme; |
| | | dataTmp.key = idx; |
| | | dataTmp.operationPort = defaultOperationPort; |
| | | |
| | | tableDataTmp.push(dataTmp); |
| | | count++; |
| | | } else { |
| | | let isused = item.anfme; |
| | | |
| | | for (let i = 0; i < item.locs.length; i++) { |
| | | if (isused == 0) { |
| | | break; |
| | | } |
| | | const val = item.locs[i]; |
| | | let dataTmp = JSON.parse(JSON.stringify(item)); |
| | | let anfme = isused - val.anfme > 0 ? val.anfme : isused; |
| | | isused -= anfme; |
| | | |
| | | dataTmp.locId = val.locId; |
| | | dataTmp.locNo = val.locNo; |
| | | dataTmp.locDetlId = val.locDetlId; |
| | | dataTmp.anfme = anfme; |
| | | dataTmp.key = idx; |
| | | dataTmp.operationPort = defaultOperationPort; |
| | | |
| | | tableDataTmp.push(dataTmp); |
| | | } |
| | | |
| | | if (isused > 0) { |
| | | let dataTmp = JSON.parse(JSON.stringify(item)); |
| | | dataTmp.locId = null; |
| | | dataTmp.locNo = null; |
| | | dataTmp.locDetlId = null; |
| | | dataTmp.anfme = isused; |
| | | dataTmp.key = idx; |
| | | dataTmp.operationPort = defaultOperationPort; |
| | | |
| | | tableDataTmp.push(dataTmp); |
| | | count++; |
| | | } |
| | | } |
| | | |
| | | colSpan[idx] = count; |
| | | idx += count; |
| | | }) |
| | | |
| | | tableDataColSpan = colSpan; |
| | | tableData.value = tableDataTmp; |
| | | |
| | | loading.value = false; |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleGlobalOperationPortChange = () => { |
| | | if (tableData.value.length > 0) { |
| | | tableData.value.forEach((item) => { |
| | | item.operationPort = globalOperationPort.value; |
| | | }) |
| | | } |
| | | } |
| | | |
| | | const handleOtherLocChange = (index, record) => { |
| | | let anfme = record.anfme; |
| | | record.otherLocs.forEach((item) => { |
| | | if (item.locId == record.locId) { |
| | | record.locNo = item.locNo; |
| | | record.locDetlId = item.locDetlId; |
| | | record.anfme = item.anfme; |
| | | } |
| | | }) |
| | | |
| | | let locDetlList = [] |
| | | let tmp = tableData.value; |
| | | tmp.forEach((item) => { |
| | | if (item.locDetlId != null) { |
| | | if (!locDetlList[item.locDetlId]) { |
| | | locDetlList[item.locDetlId] = item.anfme; |
| | | } |
| | | } |
| | | }) |
| | | |
| | | // tmp.forEach((item) => { |
| | | // if (item.locId == null) { |
| | | // item.stockAlarm = true; |
| | | // } else { |
| | | // let stock = locDetlList[item.locDetlId] |
| | | // stock = stock - item.anfme; |
| | | // locDetlList[item.locDetlId] = stock; |
| | | // if (stock >= 0) { |
| | | // item.stockAlarm = false; |
| | | // } else { |
| | | // item.stockAlarm = true; |
| | | // } |
| | | // } |
| | | // }) |
| | | } |
| | | |
| | | defineExpose({ |
| | | open, |
| | | showWidth, |
| | | waveId, |
| | | }) |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '预览波次出库' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div> |
| | | <a-modal v-model:open="open" :width="showWidth" |
| | | :title="formatMessage('page.orderOutPreview.preview', '预览合并订单出库')" @ok="handleOk"> |
| | | <div> |
| | | <span>作业口:</span> |
| | | <a-select v-model:value="globalOperationPort" :options="operationPortList" |
| | | @change="handleGlobalOperationPortChange"></a-select> |
| | | </div> |
| | | <a-table :data-source="tableData" :loading="loading" :defaultExpandAllRows="false" :key="TABLE_KEY" |
| | | rowKey="index" :scroll="{ y: 768, scrollToFirstRowOnChange: true }" :columns="columns"> |
| | | <template #bodyCell="{ column, text, record, index }"> |
| | | <template v-if="column.dataIndex === 'locNo'"> |
| | | <div v-if="record.locId != null && record.anfme > 0"> |
| | | <!-- <a-tag color="green">{{ record.locNo }}</a-tag> --> |
| | | <a-select v-model:value="record.locId" :options="record.otherLocs" |
| | | :fieldNames="{ label: 'locNo', value: 'locId' }" |
| | | @change="handleOtherLocChange(index, record)"></a-select> |
| | | </div> |
| | | <div v-else> |
| | | <a-tag color="red">库存不足</a-tag> |
| | | </div> |
| | | </template> |
| | | |
| | | <template v-if="column.dataIndex === 'operationPort'"> |
| | | <a-select v-model:value="record.operationPort" :options="operationPortList"></a-select> |
| | | </template> |
| | | </template> |
| | | </a-table> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('orderNo'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_task_detl.wave_no', '波次编号'), |
| | | dataIndex: ['wave$', 'waveNo'], |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('waveNo'), |
| | | }, |
| | | ]; |
| | | |
| | | const fieldList = []; |
| | |
| | | |
| | | watch(taskId, (newVal, oldVal) => { |
| | | if (newVal != null) { |
| | | state.loading = true; |
| | | tableData.value = [] |
| | | get("/api/taskDetl/taskId/" + newVal, {}).then((resp) => { |
| | | let result = resp.data; |
| | | let index = 1; |
| | |
| | | tmp.push(item) |
| | | }) |
| | | tableData.value = tmp; |
| | | |
| | | state.loading = false; |
| | | }) |
| | | |
| | | get("/api/task/" + newVal, {}).then((resp) => { |
| | |
| | | </div> |
| | | </div> |
| | | <a-table :data-source="tableData" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" |
| | | :scroll="{ y: 768 }" :columns="state.columns"> |
| | | :scroll="{ y: 768 }" :columns="state.columns" :loading="state.loading"> |
| | | <template #bodyCell="{ column, text, record }"> |
| | | <template v-if="column.dataIndex === 'orderNo'"> |
| | | <a-button type="link" @click="openOrderDetl(record)">{{ text }}</a-button> |
| | | </template> |
| | | |
| | | <template v-if="typeof (column.dataIndex) === 'object'"> |
| | | <template v-if="column.dataIndex[1] === 'waveNo'"> |
| | | {{ text }} |
| | | </template> |
| | | </template> |
| | | </template> |
| | | </a-table> |
| | | </a-modal> |
| | |
| | | <script setup> |
| | | import OrderView from '@/components/order/index.vue'; |
| | | import OrderView from '@/components/order/order/index.vue'; |
| | | </script> |
| | | |
| | | <script> |
| | |
| | | <script setup> |
| | | import OrderView from '@/components/order/index.vue'; |
| | | import OrderView from '@/components/order/order/index.vue'; |
| | | </script> |
| | | |
| | | <script> |
| | |
| | | <script setup> |
| | | import OrderView from '@/components/order/index.vue'; |
| | | import OrderView from '@/components/order/order/index.vue'; |
| | | </script> |
| | | |
| | | <script> |
New file |
| | |
| | | <script setup> |
| | | import { 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 { formatMessage } from '@/utils/localeUtils.js'; |
| | | import useTableSearch from '@/utils/tableUtils.jsx'; |
| | | import OrderOutBatchPreviewView from '@/components/orderOut/orderOutBatchPreview/index.vue'; |
| | | import OrderOutMergePreviewView from '@/components/orderOut/orderOutMergePreview/index.vue'; |
| | | |
| | | const router = useRouter(); |
| | | |
| | | const emit = defineEmits(['pageReload']) |
| | | |
| | | const TABLE_KEY = 'table-order-detl'; |
| | | let currentPage = 1; |
| | | let pageSize = 10; |
| | | |
| | | const { |
| | | getColumnSearchProps, |
| | | handleResizeColumn, |
| | | } = useTableSearch(); |
| | | |
| | | let currentOrder = ref(null); |
| | | let searchInput = ref(null); |
| | | let tableData = ref([]); |
| | | const orderOutBatchPreviewChild = ref(null); |
| | | const orderOutMergePreviewChild = ref(null); |
| | | const checkedOrderKeys = ref([]); |
| | | getPage(); |
| | | |
| | | const columns = [ |
| | | { |
| | | title: formatMessage('db.man_order_detl.order_no', '订单编号'), |
| | | dataIndex: 'orderNo', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('orderNo'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order_detl.anfme', '数量'), |
| | | dataIndex: 'anfme', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('anfme'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order_detl.qty', '已完成数量'), |
| | | dataIndex: 'qty', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('qty'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order_detl.work_qty', '作业中数量'), |
| | | dataIndex: 'workQty', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('workQty'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order_detl.matnr', '商品编号'), |
| | | dataIndex: ['mat$', 'matnr'], |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('matId$'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_order_detl.batch', '批号'), |
| | | dataIndex: 'batch', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('batch'), |
| | | }, |
| | | |
| | | { |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 140, |
| | | }, |
| | | ]; |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | | loading: false, |
| | | }); |
| | | const onSelectChange = selectedRowKeys => { |
| | | // console.log('selectedRowKeys changed: ', selectedRowKeys); |
| | | state.selectedRowKeys = selectedRowKeys; |
| | | }; |
| | | |
| | | function getPage() { |
| | | if (currentOrder.value != null) { |
| | | get('/api/orderDetl/orderId/' + currentOrder.value.id, {}).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); |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | function handleTableReload(value) { |
| | | getPage() |
| | | } |
| | | |
| | | let orderData = ref([]); |
| | | let searchOrder = ref(""); |
| | | getOrderData() |
| | | function getOrderData() { |
| | | post('/api/order/out/page', { |
| | | current: currentPage, |
| | | pageSize: pageSize, |
| | | condition: searchOrder.value, |
| | | orderOut: true, |
| | | }).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | let data = result.data.records; |
| | | orderData.value = data |
| | | } else if (result.code === 401) { |
| | | message.error(result.msg); |
| | | logout() |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleOrderSelected = (selectedKeys, e) => { |
| | | currentOrder.value = e.selectedNodes[0]; |
| | | getPage() |
| | | } |
| | | |
| | | const handleSearchOrder = (e) => { |
| | | getOrderData() |
| | | } |
| | | |
| | | const handleBatchOrderOut = () => { |
| | | let data = state.selectedRowKeys; |
| | | handleOrderOutPreview(data) |
| | | } |
| | | |
| | | const handleOrderOutPreview = (data) => { |
| | | if (data.length == 0) { |
| | | message.error(formatMessage("page.orderOut.batchOrderOut.error", "请选择至少一条出库明细")); |
| | | return; |
| | | } |
| | | |
| | | orderOutBatchPreviewChild.value.open = true; |
| | | orderOutBatchPreviewChild.value.records = data; |
| | | } |
| | | |
| | | const handleMergeOrderOut = () => { |
| | | let orderIdList = []; |
| | | checkedOrderKeys.value.forEach((idx) => { |
| | | let index = parseInt(idx.split("-")[1]); |
| | | orderIdList.push(orderData.value[index].id) |
| | | }) |
| | | |
| | | if (orderIdList.length == 0) { |
| | | message.error(formatMessage("page.orderOut.mergeOrderOut.error", "请选择至少一条订单")); |
| | | return; |
| | | } |
| | | |
| | | orderOutMergePreviewChild.value.open = true; |
| | | orderOutMergePreviewChild.value.records = orderIdList; |
| | | } |
| | | |
| | | const handleChildReload = () => { |
| | | handleTableReload() |
| | | } |
| | | |
| | | const handleGenerateWave = () => { |
| | | let orderIdList = []; |
| | | checkedOrderKeys.value.forEach((idx) => { |
| | | let index = parseInt(idx.split("-")[1]); |
| | | orderIdList.push(orderData.value[index].id) |
| | | }) |
| | | |
| | | if (orderIdList.length == 0) { |
| | | message.error(formatMessage("page.orderOut.mergeOrderOut.error", "请选择至少一条订单")); |
| | | return; |
| | | } |
| | | |
| | | post('/api/out/wave/generate', orderIdList).then((resp) => { |
| | | let result = resp.data; |
| | | if (result.code == 200) { |
| | | message.success(formatMessage('page.add.success', '成功')); |
| | | emit('pageReload', 'reload') |
| | | } else { |
| | | message.error(result.msg); |
| | | } |
| | | }) |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | | export default { |
| | | name: '订单出库' |
| | | } |
| | | </script> |
| | | |
| | | <template> |
| | | <div style="display: flex;"> |
| | | <a-card :title="formatMessage('common.order', '订单')" style="flex: 4;margin-right: 30px;"> |
| | | <div style="margin-bottom: 10px;display: flex;"> |
| | | <!-- <div style="margin-right: 10px;"> |
| | | <a-button @click="handleMergeOrderOut()"> |
| | | {{ formatMessage('common.orderOut', '合并订单') }} |
| | | </a-button> |
| | | </div> --> |
| | | <div style="margin-right: 10px;"> |
| | | <a-button @click="handleGenerateWave()"> |
| | | {{ formatMessage('common.generateWave', '生成波次') }} |
| | | </a-button> |
| | | </div> |
| | | </div> |
| | | <a-input v-model:value="searchOrder" @change="handleSearchOrder" |
| | | :placeholder="formatMessage('page.input', '请输入')" style="margin-bottom: 8px" /> |
| | | <a-tree @select="handleOrderSelected" :tree-data="orderData" v-model:checkedKeys="checkedOrderKeys" |
| | | checkable blockNode> |
| | | <template #title="{ orderNo, createTime$ }"> |
| | | <div style="display: flex;justify-content: space-between"> |
| | | <div>{{ orderNo }}</div> |
| | | <div>{{ createTime$ }}</div> |
| | | </div> |
| | | </template> |
| | | </a-tree> |
| | | </a-card> |
| | | |
| | | <a-card style="flex: 10;"> |
| | | <div class="table-header"> |
| | | <a-button size="small" @click="handleBatchOrderOut()"> |
| | | {{ formatMessage('common.orderOut', '批量出库') }} |
| | | </a-button> |
| | | </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="columns"> |
| | | <template #bodyCell="{ column, text, record }"> |
| | | <template v-if="column.dataIndex === 'oper'"> |
| | | <div style="display: flex;justify-content: space-evenly;"> |
| | | <a-button size="small" @click="handleOrderOutPreview([record.id])"> |
| | | {{ formatMessage('common.orderOut', '出库') }} |
| | | </a-button> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | </a-table> |
| | | </a-card> |
| | | |
| | | <OrderOutBatchPreviewView ref="orderOutBatchPreviewChild" @reload="handleChildReload" /> |
| | | <OrderOutMergePreviewView ref="orderOutMergePreviewChild" @reload="handleChildReload" /> |
| | | </div> |
| | | </template> |
| | | |
| | | <style></style> |
| | |
| | | ...getColumnSearchProps('batch'), |
| | | }, |
| | | |
| | | { |
| | | title: formatMessage('common.operation', '操作'), |
| | | name: 'oper', |
| | | dataIndex: 'oper', |
| | | key: 'oper', |
| | | width: 140, |
| | | }, |
| | | // { |
| | | // title: formatMessage('common.operation', '操作'), |
| | | // name: 'oper', |
| | | // dataIndex: 'oper', |
| | | // key: 'oper', |
| | | // width: 140, |
| | | // }, |
| | | ]; |
| | | |
| | | const state = reactive({ |
| | |
| | | |
| | | <a-card style="flex: 10;"> |
| | | <div class="table-header"> |
| | | <a-button size="small" @click="handleBatchOrderOut()"> |
| | | <!-- <a-button size="small" @click="handleBatchOrderOut()"> |
| | | {{ formatMessage('common.orderOut', '批量出库') }} |
| | | </a-button> |
| | | </a-button> --> |
| | | </div> |
| | | <a-table :row-selection="{ selectedRowKeys: state.selectedRowKeys, onChange: onSelectChange }" |
| | | :data-source="tableData" :defaultExpandAllRows="false" :key="TABLE_KEY" rowKey="id" |
| | |
| | | import EditView from './edit.vue' |
| | | import { formatMessage } from '@/utils/localeUtils.js'; |
| | | import useTableSearch from '@/utils/tableUtils.jsx'; |
| | | import OrderOutMergePreviewView from '@/components/orderOut/orderOutMergePreview/index.vue'; |
| | | import OrderOutWavePreviewView from '@/components/orderOut/orderOutWavePreview/index.vue'; |
| | | const context = getCurrentInstance()?.appContext.config.globalProperties; |
| | | |
| | | const router = useRouter(); |
| | |
| | | let pageSize = 10; |
| | | const searchInput = ref("") |
| | | const editChild = ref(null) |
| | | const orderOutMergePreviewChild = ref(null); |
| | | const orderOutWavePreviewChild = ref(null); |
| | | |
| | | const state = reactive({ |
| | | selectedRowKeys: [], |
| | |
| | | }, |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_wave.orderNo', '订单号'), |
| | | dataIndex: ['orderNo'], |
| | | title: formatMessage('db.man_wave.waveStatus$', '状态'), |
| | | dataIndex: 'waveStatus$', |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('waveType$'), |
| | | ...getColumnSearchProps('waveStatus$'), |
| | | customCell: (_, index) => { |
| | | return customColSpanProps(index) |
| | | }, |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_wave.matnr', '商品编号'), |
| | |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_wave.batch', '批号'), |
| | | dataIndex: ['mat$', 'batch'], |
| | | dataIndex: ['batch'], |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('batch'), |
| | |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('anfme'), |
| | | }, |
| | | { |
| | | title: formatMessage('db.man_wave.work_qty', '工作数量'), |
| | | dataIndex: ['workQty'], |
| | | width: 140, |
| | | ellipsis: true, |
| | | ...getColumnSearchProps('workQty'), |
| | | }, |
| | | |
| | | ]; |
| | |
| | | data.forEach((item) => { |
| | | let count = 0; |
| | | |
| | | item.waveDetlList.forEach((val) => { |
| | | count += val.orderDetl$.length; |
| | | val.orderDetl$.forEach((detl) => { |
| | | detl.key = idx; |
| | | detl.waveNo = item.waveNo; |
| | | detl.waveId = item.id; |
| | | item.waveDetlList.forEach((detl) => { |
| | | detl.waveStatus = item.waveStatus; |
| | | detl.waveStatus$ = item.waveStatus$; |
| | | detl.waveType = item.waveType; |
| | | detl.waveType$ = item.waveType$; |
| | | detl.generateTask = item.generateTask; |
| | | |
| | | count++; |
| | | tmp.push(detl) |
| | | }) |
| | | }) |
| | | |
| | | colSpan[idx] = count; |
| | |
| | | // editChild.value.isSave = item == null; |
| | | // } |
| | | |
| | | const handleGenerateOut = (item) => { |
| | | get('/api/wave/list/' + item.waveId, {}).then(resp => { |
| | | let result = resp.data; |
| | | let data = result.data; |
| | | let orderIds = [] |
| | | data.forEach((item) => { |
| | | orderIds.push(item.orderId) |
| | | }) |
| | | |
| | | orderOutMergePreviewChild.value.open = true; |
| | | orderOutMergePreviewChild.value.records = orderIds; |
| | | orderOutMergePreviewChild.value.waveId = item.waveId; |
| | | }) |
| | | const handleGenerateOut = (waveId) => { |
| | | orderOutWavePreviewChild.value.open = true; |
| | | orderOutWavePreviewChild.value.waveId = waveId; |
| | | } |
| | | |
| | | const handleDel = (rows) => { |
| | | Modal.confirm({ |
| | | title: formatMessage('page.delete', '删除'), |
| | | content: formatMessage('page.delete.confirm', '确定删除该项吗?'), |
| | | title: formatMessage('page.cancel', '取消'), |
| | | content: formatMessage('page.cancel.confirm', '确定取消该项吗?'), |
| | | maskClosable: true, |
| | | onOk: async () => { |
| | | const hide = message.loading(formatMessage('common.loading', '请求中')); |
| | |
| | | <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="handleGenerateOut(record)" :disabled="record.generateTask">{{ |
| | | <a-button type="link" primary @click="handleGenerateOut(record.waveId)">{{ |
| | | formatMessage('page.generateOut', |
| | | '生成出库任务') |
| | | }}</a-button> |
| | | <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '删除') |
| | | <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.cancel', '取消') |
| | | }}</a-button> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | </a-table> |
| | | |
| | | <OrderOutMergePreviewView ref="orderOutMergePreviewChild" @reload="handleChildReload" /> |
| | | <OrderOutWavePreviewView ref="orderOutWavePreviewChild" @reload="handleChildReload" /> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | loading: false, |
| | | }); |
| | | |
| | | const reviewState = reactive({ |
| | | open: false, |
| | | record: null, |
| | | reviewNum: null |
| | | }); |
| | | |
| | | let tableData = ref([]); |
| | | getPage(); |
| | | |
| | |
| | | getPage() |
| | | } |
| | | |
| | | const handleReview = (record) => { |
| | | reviewState.open = true; |
| | | reviewState.record = record; |
| | | reviewState.reviewNum = 0; |
| | | } |
| | | |
| | | const handleReviewOk = () => { |
| | | |
| | | } |
| | | |
| | | </script> |
| | | |
| | | <script> |
| | |
| | | <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" primary @click="handleEdit(record)">{{ formatMessage('page.edit', '编辑') }}</a-button> --> |
| | | <a-button type="link" primary @click="handleReview(record)">{{ formatMessage('page.review', '复核') |
| | | }}</a-button> |
| | | <a-button type="link" danger @click="handleDel([record])">{{ formatMessage('page.delete', '删除') |
| | | }}</a-button> |
| | | </div> |
| | | </template> |
| | | </template> |
| | | </a-table> |
| | | |
| | | <a-modal v-model:open="reviewState.open" :title="formatMessage('page.review', '复核')" @ok="handleReviewOk"> |
| | | <div> |
| | | 播种数量:{{ reviewState.record.anfme }} |
| | | </div> |
| | | <div> |
| | | 实际数量:<a-input v-model:value="reviewState.reviewNum" /> |
| | | </div> |
| | | </a-modal> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | ExcelUtil.build(ExcelUtil.create(cacheSiteService.list(), CacheSite.class), response); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:cacheSite:list')") |
| | | @PostMapping("/cacheSite/channel/list") |
| | | public R channelList() { |
| | | return R.ok().add(cacheSiteService.getChannelList()); |
| | | } |
| | | |
| | | } |
| | |
| | | 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; |
| | | import com.zy.asrs.wms.asrs.service.MatFieldService; |
| | |
| | | locDetlField.setName(matField.getName()); |
| | | locDetlFieldService.save(locDetlField); |
| | | } |
| | | |
| | | return R.ok("添加成功"); |
| | | } |
| | | |
| | |
| | | package com.zy.asrs.wms.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.common.R; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.asrs.entity.Order; |
| | | import com.zy.asrs.wms.asrs.entity.WaveDetl; |
| | | import com.zy.asrs.wms.asrs.entity.dto.MergePreviewDto; |
| | | import com.zy.asrs.wms.asrs.entity.dto.MergePreviewResultDto; |
| | | import com.zy.asrs.wms.asrs.entity.dto.OrderOutBatchPreviewDto; |
| | | import com.zy.asrs.wms.asrs.entity.param.*; |
| | | import com.zy.asrs.wms.asrs.manage.OutManage; |
| | | import com.zy.asrs.wms.asrs.service.OrderService; |
| | | import com.zy.asrs.wms.asrs.service.WaveDetlService; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | 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.ArrayList; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private OutManage outManage; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private WaveDetlService waveDetlService; |
| | | |
| | | /** |
| | | * 出库 |
| | |
| | | return R.ok().add(dtos); |
| | | } |
| | | |
| | | @PostMapping("/out/orderOut/merge") |
| | | @OperationLog("合并订单出库") |
| | | @PostMapping("/out/orderOut/wave/preview") |
| | | @OperationLog("预览波次出库") |
| | | @Transactional |
| | | public R orderOutWavePreview(@RequestBody OrderOutWavePreviewParam param) { |
| | | if (param == null) { |
| | | throw new CoolException("参数不能为空"); |
| | | } |
| | | |
| | | Long waveId = param.getWaveId(); |
| | | if (waveId == null) { |
| | | throw new CoolException("波次不能为空"); |
| | | } |
| | | |
| | | List<Long> orderIds = new ArrayList<>(); |
| | | List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getWaveId, waveId)); |
| | | for (Order order : orders) { |
| | | orderIds.add(order.getId()); |
| | | } |
| | | |
| | | List<MergePreviewDto> dtos = new ArrayList<>(); |
| | | List<WaveDetl> waveDetls = waveDetlService.list(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getWaveId, waveId)); |
| | | for (WaveDetl waveDetl : waveDetls) { |
| | | MergePreviewDto dto = new MergePreviewDto(); |
| | | dtos.add(dto); |
| | | |
| | | double anfme = waveDetl.getAnfme() - waveDetl.getWorkQty(); |
| | | dto.setMatnr(waveDetl.getMatnr()); |
| | | dto.setBatch(waveDetl.getBatch()); |
| | | dto.setAnfme(anfme); |
| | | dto.setOrderIds(orderIds); |
| | | dto.setFieldParams(JSON.parseArray(waveDetl.getFieldParams(), FieldParam.class)); |
| | | dto.setFieldParamsEncode(waveDetl.getFieldParams()); |
| | | } |
| | | |
| | | List<MergePreviewResultDto> resultDtos = outManage.orderOutMergeLocPreview(dtos); |
| | | return R.ok().add(resultDtos); |
| | | } |
| | | |
| | | @PostMapping("/out/orderOut/merge/wave") |
| | | @OperationLog("波次合并订单出库") |
| | | @Transactional |
| | | public R orderOutMerge(@RequestBody OrderOutMergeParamDto param) { |
| | | outManage.orderOutMerge(param); |
| | | outManage.orderOutMergeWave(param); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping("/out/wave/generate") |
| | | @OperationLog("生成波次") |
| | | @Transactional |
| | | public R generateWave(@RequestBody List<Long> orderIds) { |
| | | outManage.generateWave(orderIds); |
| | | public R generateWave(@RequestBody GenerateWaveParam param) { |
| | | outManage.generateWave(param); |
| | | return R.ok(); |
| | | } |
| | | |
| | |
| | | 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.TaskDetl; |
| | | import com.zy.asrs.wms.asrs.entity.WaveDetl; |
| | | import com.zy.asrs.wms.asrs.service.TaskDetlService; |
| | | import com.zy.asrs.wms.asrs.service.WaveDetlService; |
| | | import com.zy.asrs.wms.common.annotation.OperationLog; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | |
| | | 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; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | @RequestMapping("/api") |
| | |
| | | private WaveService waveService; |
| | | @Autowired |
| | | private WaveDetlService waveDetlService; |
| | | @Autowired |
| | | private TaskDetlService taskDetlService; |
| | | |
| | | @PreAuthorize("hasAuthority('asrs:wave:list')") |
| | | @PostMapping("/wave/page") |
| | |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Wave, BaseParam> pageParam = new PageParam<>(baseParam, Wave.class); |
| | | PageParam<Wave, BaseParam> page = waveService.page(pageParam, pageParam.buildWrapper(true)); |
| | | |
| | | List<Wave> records = page.getRecords(); |
| | | for (Wave record : records) { |
| | | ArrayList<Long> orderDetlIds = new ArrayList<>(); |
| | | for (WaveDetl waveDetl : record.getWaveDetlList()) { |
| | | orderDetlIds.add(waveDetl.getOrderId()); |
| | | } |
| | | |
| | | List<TaskDetl> taskDetls = taskDetlService.list(new LambdaQueryWrapper<TaskDetl>().in(TaskDetl::getOrderId, orderDetlIds)); |
| | | if (taskDetls.isEmpty()) { |
| | | record.setGenerateTask(false); |
| | | }else { |
| | | record.setGenerateTask(true); |
| | | } |
| | | } |
| | | return R.ok().add(page); |
| | | } |
| | | |
| | |
| | | package com.zy.asrs.wms.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | |
| | | 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; |
| | |
| | | * 订单ID |
| | | */ |
| | | @ApiModelProperty(value= "订单ID") |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private Long orderId; |
| | | |
| | | /** |
| | | * 订单编号 |
| | | */ |
| | | @ApiModelProperty(value= "订单编号") |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private String orderNo; |
| | | |
| | | /** |
| | |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | /** |
| | | * 通道 |
| | | */ |
| | | @ApiModelProperty(value= "通道") |
| | | private String channel; |
| | | |
| | | public CacheSite() {} |
| | | |
| | | public CacheSite(String siteNo,Integer siteStatus,Long orderId,String orderNo,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { |
| | |
| | | package com.zy.asrs.wms.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | |
| | | 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.wms.system.service.HostService; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("man_loc_detl") |
| | |
| | | @TableField(updateStrategy = FieldStrategy.IGNORED) |
| | | private String waveNo; |
| | | |
| | | /** |
| | | * 是否生成波次 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否生成波次 1: 是 0: 否 ") |
| | | private Integer hasWave; |
| | | |
| | | public Order() {} |
| | | |
| | | public Order(String orderNo,String orderTime,Long orderType,Long orderSettle,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { |
| | |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | /** |
| | | * 商品库存索引 |
| | | */ |
| | | @ApiModelProperty(value= "商品库存索引") |
| | | private String stockIndex; |
| | | |
| | | public OrderDetl() {} |
| | | |
| | | public OrderDetl(Long orderId,String orderNo,Double anfme,Double qty,Double workQty,Long matId,String batch,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { |
| | |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | /** |
| | | * 波次ID |
| | | */ |
| | | @ApiModelProperty(value= "波次ID") |
| | | private Long waveId; |
| | | |
| | | public TaskDetl() {} |
| | | |
| | | public TaskDetl(Long taskId,String taskNo,Double anfme,String batch,String barcode,Long orderId,String orderNo,Long detlId,Long matId,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | public Wave getWave$(){ |
| | | WaveService service = SpringUtils.getBean(WaveService.class); |
| | | Wave wave = service.getById(this.waveId); |
| | | if (!Cools.isEmpty(wave)){ |
| | | return wave; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getHostId$(){ |
| | | HostService service = SpringUtils.getBean(HostService.class); |
| | | Host host = service.getById(this.hostId); |
| | |
| | | package com.zy.asrs.wms.asrs.entity; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.*; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.wms.asrs.entity.param.FieldParam; |
| | | import com.zy.asrs.wms.asrs.service.WaveDetlService; |
| | | import com.zy.asrs.wms.system.entity.Host; |
| | | import com.zy.asrs.wms.system.entity.User; |
| | | import com.zy.asrs.wms.utils.Utils; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @TableName("man_wave") |
| | |
| | | */ |
| | | @ApiModelProperty(value= "波次类型 0: 手动 1: 自动 ") |
| | | private Integer waveType; |
| | | |
| | | /** |
| | | * 波次状态 0: 初始化 1: 生成任务 2: 任务播种 3: 完成 |
| | | */ |
| | | @ApiModelProperty(value= "波次状态 0: 初始化 1: 生成任务 2: 任务播种 3: 完成 ") |
| | | private Integer waveStatus; |
| | | |
| | | /** |
| | | * 所属机构 |
| | |
| | | } |
| | | } |
| | | |
| | | public String getWaveStatus$(){ |
| | | if (null == this.waveStatus){ return null; } |
| | | switch (this.waveStatus){ |
| | | case 0: |
| | | return "初始化"; |
| | | case 1: |
| | | return "生成任务"; |
| | | case 2: |
| | | return "任务播种"; |
| | | case 3: |
| | | return "完成"; |
| | | default: |
| | | return String.valueOf(this.waveStatus); |
| | | } |
| | | } |
| | | |
| | | public List<WaveDetl> getWaveDetlList(){ |
| | | if (null == this.id){ return null; } |
| | | WaveDetlService service = SpringUtils.getBean(WaveDetlService.class); |
| | |
| | | if (waveDetls.isEmpty()) { |
| | | return null; |
| | | } |
| | | for (WaveDetl waveDetl : waveDetls) { |
| | | String fieldParams = waveDetl.getFieldParams(); |
| | | List<FieldParam> list = JSON.parseArray(fieldParams, FieldParam.class); |
| | | waveDetl.setDynamicFields(list); |
| | | } |
| | | return waveDetls; |
| | | } |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.*; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.fasterxml.jackson.annotation.JsonAnyGetter; |
| | | import com.zy.asrs.wms.asrs.entity.param.FieldParam; |
| | | 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.WaveService; |
| | |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | @TableName("man_wave_detl") |
| | |
| | | private String waveNo; |
| | | |
| | | /** |
| | | * 订单ID |
| | | * 商品ID |
| | | */ |
| | | @ApiModelProperty(value= "订单ID") |
| | | private Long orderId; |
| | | @ApiModelProperty(value= "商品ID") |
| | | private Long matId; |
| | | |
| | | /** |
| | | * 订单号 |
| | | * 商品编号 |
| | | */ |
| | | @ApiModelProperty(value= "订单号") |
| | | private String orderNo; |
| | | @ApiModelProperty(value= "商品编号") |
| | | private String matnr; |
| | | |
| | | /** |
| | | * 批号 |
| | | */ |
| | | @ApiModelProperty(value= "批号") |
| | | private String batch; |
| | | |
| | | /** |
| | | * 商品库存索引 |
| | | */ |
| | | @ApiModelProperty(value= "商品库存索引") |
| | | private String stockIndex; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | | @ApiModelProperty(value= "数量") |
| | | private Double anfme; |
| | | |
| | | /** |
| | | * 工作数量 |
| | | */ |
| | | @ApiModelProperty(value= "工作数量") |
| | | private Double workQty; |
| | | |
| | | /** |
| | | * 所属机构 |
| | |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | /** |
| | | * 索引字段 |
| | | */ |
| | | @ApiModelProperty(value= "索引字段") |
| | | private String fieldParams; |
| | | |
| | | public WaveDetl() {} |
| | | |
| | | public WaveDetl(Long waveId,String waveNo,Long orderId,String orderNo,Long hostId,Integer status,Integer deleted,Date createTime,Long createBy,Date updateTime,Long updateBy,String memo) { |
| | | public WaveDetl(Long waveId, String waveNo, String matnr, String batch, String stockIndex, Double anfme, Double workQty, Long hostId, Integer status, Integer deleted, Date createTime, Long createBy, Date updateTime, Long updateBy, String memo) { |
| | | this.waveId = waveId; |
| | | this.waveNo = waveNo; |
| | | this.orderId = orderId; |
| | | this.orderNo = orderNo; |
| | | this.matnr = matnr; |
| | | this.batch = batch; |
| | | this.stockIndex = stockIndex; |
| | | this.anfme = anfme; |
| | | this.workQty = workQty; |
| | | this.hostId = hostId; |
| | | this.status = status; |
| | | this.deleted = deleted; |
| | |
| | | return null; |
| | | } |
| | | |
| | | public String getOrderId$(){ |
| | | OrderService service = SpringUtils.getBean(OrderService.class); |
| | | Order order = service.getById(this.orderId); |
| | | if (!Cools.isEmpty(order)){ |
| | | return String.valueOf(order.getId()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public Order getOrder$(){ |
| | | OrderService service = SpringUtils.getBean(OrderService.class); |
| | | Order order = service.getById(this.orderId); |
| | | if (!Cools.isEmpty(order)){ |
| | | return order; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public List<OrderDetl> getOrderDetl$(){ |
| | | OrderDetlService service = SpringUtils.getBean(OrderDetlService.class); |
| | | List<OrderDetl> orderDetls = service.list(new LambdaQueryWrapper<OrderDetl>().eq(OrderDetl::getOrderId, this.orderId)); |
| | | if (!orderDetls.isEmpty()){ |
| | | return service.parseDetl(orderDetls); |
| | | public Mat getMat$(){ |
| | | MatService service = SpringUtils.getBean(MatService.class); |
| | | Mat mat = service.getById(this.matId); |
| | | if (!Cools.isEmpty(mat)){ |
| | | return mat; |
| | | } |
| | | return null; |
| | | } |
| | |
| | | public void sync(Object source) { |
| | | Synchro.Copy(source, this); |
| | | } |
| | | |
| | | //动态扩展字段 |
| | | public transient Map<String, Object> dynamicFields = new HashMap<>(); |
| | | |
| | | @JsonAnyGetter |
| | | public Map<String,Object> getDynamicFields() { |
| | | return dynamicFields; |
| | | } |
| | | |
| | | public void setDynamicFields(List<FieldParam> list) { |
| | | for (FieldParam param : list) { |
| | | dynamicFields.put(param.getName(), param.getValue()); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | private List<MergePreviewResultLocDto> locs; |
| | | |
| | | private List<MergePreviewResultLocDto> otherLocs; |
| | | |
| | | private List<FieldParam> fieldParams; |
| | | |
| | | private String fieldParamsEncode; |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.entity.dto; |
| | | |
| | | import com.zy.asrs.common.utils.Synchro; |
| | | import com.zy.asrs.wms.asrs.entity.param.FieldParam; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class OrderOutMergeWaveDto { |
| | | |
| | | private Long locId; |
| | | |
| | | private String locNo; |
| | | |
| | | private Long locDetlId; |
| | | |
| | | private String matnr; |
| | | |
| | | private String batch; |
| | | |
| | | private Double anfme; |
| | | |
| | | private Long operationPort; |
| | | |
| | | private List<FieldParam> fieldParams; |
| | | |
| | | public void sync(Object source) { |
| | | Synchro.Copy(source, this); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | INIT(0, "初始化"), |
| | | WAIT(1, "待处理"), |
| | | WORKING(2, "作业中"), |
| | | CANCEL(3, "已取消"), |
| | | COMPLETE(4, "已完成"), |
| | | WAIT_CANCEL(5, "准备取消"), |
| | | REPORT_COMPLETE(6, "上报完成"), |
| | | WAVE(2, "波次生成"), |
| | | WORKING(3, "作业中"), |
| | | CANCEL(4, "已取消"), |
| | | COMPLETE(5, "已完成"), |
| | | WAIT_CANCEL(6, "准备取消"), |
| | | REPORT_COMPLETE(7, "上报完成"), |
| | | ; |
| | | |
| | | |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.entity.enums; |
| | | |
| | | public enum WaveStatusType { |
| | | |
| | | INIT(0, "初始化"), |
| | | GENERATE(1, "生成任务"), |
| | | SEED(2, "任务播种"), |
| | | COMPLETE(3, "完成"), |
| | | ; |
| | | |
| | | |
| | | public Integer id; |
| | | public String desc; |
| | | |
| | | WaveStatusType(Integer id, String desc) { |
| | | this.id = id; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.entity.param; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class GenerateWaveParam { |
| | | |
| | | private List<String> channels; |
| | | |
| | | private List<Long> orderIds; |
| | | |
| | | } |
| | |
| | | @Data |
| | | public class OrderOutMergePreviewParam { |
| | | |
| | | private Long waveId; |
| | | |
| | | private List<Long> orderIds; |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.entity.param; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class OrderOutWavePreviewParam { |
| | | |
| | | private Long waveId; |
| | | |
| | | } |
| | |
| | | import com.zy.asrs.wms.asrs.entity.dto.OrderOutMergeDto; |
| | | import com.zy.asrs.wms.asrs.entity.enums.CacheSiteStatusType; |
| | | import com.zy.asrs.wms.asrs.entity.enums.LocStsType; |
| | | import com.zy.asrs.wms.asrs.entity.enums.OrderSettleType; |
| | | import com.zy.asrs.wms.asrs.entity.enums.WaveStatusType; |
| | | import com.zy.asrs.wms.asrs.entity.param.*; |
| | | import com.zy.asrs.wms.asrs.entity.*; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | |
| | | TaskDetl taskDetl = new TaskDetl(); |
| | | taskDetl.sync(locDetl); |
| | | taskDetl.setTaskId(task.getId()); |
| | | taskDetl.setTaskNo(task.getTaskNo()); |
| | | taskDetl.setAnfme(detl.getAnfme()); |
| | | taskDetl.setStock(detl.getStock()); |
| | | taskDetl.setOrderId(null); |
| | |
| | | taskDetl.sync(locDetl); |
| | | taskDetl.setId(null); |
| | | taskDetl.setTaskId(task.getId()); |
| | | taskDetl.setTaskNo(task.getTaskNo()); |
| | | taskDetl.setAnfme(dto.getAnfme()); |
| | | taskDetl.setStock(locDetl.getAnfme()); |
| | | taskDetl.setOrderId(orderDetl.getOrderId()); |
| | |
| | | for (MergePreviewDto dto : param) { |
| | | List<LocDetl> locDetls = locDetlService.queryStock(dto.getMatnr(), dto.getBatch(), dto.getFieldParams(), sortParams); |
| | | if(locDetls.isEmpty()){ |
| | | MergePreviewResultDto resultDto = new MergePreviewResultDto(); |
| | | resultDto.sync(dto); |
| | | resultDto.setLocs(new ArrayList<>()); |
| | | resultDto.setOrderIds(dto.getOrderIds()); |
| | | resultDto.setAnfme(dto.getAnfme()); |
| | | resultDtos.add(resultDto); |
| | | continue; |
| | | } |
| | | |
| | |
| | | |
| | | Double anfme = dto.getAnfme(); |
| | | for (LocDetl locDetl : locDetls) { |
| | | Loc loc = locService.getById(locDetl.getLocId()); |
| | | if (loc == null) { |
| | | throw new CoolException("库位数据不存在"); |
| | | } |
| | | |
| | | if (loc.getLocStsId() != LocStsType.F.val()) { |
| | | continue; |
| | | } |
| | | |
| | | MergePreviewResultLocDto locDto = new MergePreviewResultLocDto(); |
| | | locDto.setLocId(locDetl.getLocId()); |
| | | locDto.setLocNo(locDetl.getLocNo()); |
| | |
| | | locDto.setAnfme(locDetl.getAnfme()); |
| | | anfme -= locDetl.getAnfme(); |
| | | } |
| | | resultDto.setAnfme(anfme < 0 ? 0 : anfme); |
| | | |
| | | List<MergePreviewResultLocDto> otherLocDtos = new ArrayList<>(); |
| | | for (LocDetl locDetl : locDetls) { |
| | | Loc loc = locService.getById(locDetl.getLocId()); |
| | | if (loc == null) { |
| | | throw new CoolException("库位数据不存在"); |
| | | } |
| | | |
| | | if (loc.getLocStsId() != LocStsType.F.val()) { |
| | | continue; |
| | | } |
| | | |
| | | MergePreviewResultLocDto locDto = new MergePreviewResultLocDto(); |
| | | locDto.setLocId(locDetl.getLocId()); |
| | | locDto.setLocNo(locDetl.getLocNo()); |
| | | locDto.setLocDetlId(locDetl.getId()); |
| | | locDto.setAnfme(locDetl.getAnfme()); |
| | | otherLocDtos.add(locDto); |
| | | } |
| | | resultDto.setOtherLocs(otherLocDtos); |
| | | |
| | | resultDto.setAnfme(dto.getAnfme()); |
| | | |
| | | resultDtos.add(resultDto); |
| | | } |
| | |
| | | taskDetl.sync(locDetl); |
| | | taskDetl.setId(null); |
| | | taskDetl.setTaskId(task.getId()); |
| | | taskDetl.setTaskNo(task.getTaskNo()); |
| | | taskDetl.setAnfme(merge.getAnfme()); |
| | | taskDetl.setStock(locDetl.getAnfme()); |
| | | taskDetl.setOrderId(orderDetl.getOrderId()); |
| | |
| | | |
| | | } |
| | | |
| | | if (dto.getWaveId() != null) { |
| | | HashMap<Long, List<TaskDetl>> orderMap = new HashMap<>(); |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | Long orderId = taskDetl.getOrderId(); |
| | | |
| | | List<TaskDetl> list = orderMap.get(orderId); |
| | | if (list == null) { |
| | | list = new ArrayList<>(); |
| | | } |
| | | |
| | | list.add(taskDetl); |
| | | orderMap.put(orderId, list); |
| | | } |
| | | |
| | | for (Map.Entry<Long, List<TaskDetl>> entry : orderMap.entrySet()) { |
| | | List<TaskDetl> list = entry.getValue(); |
| | | |
| | | List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getSiteStatus, CacheSiteStatusType.O.id)); |
| | | if (cacheSites.isEmpty()) { |
| | | throw new CoolException("缓存站空间不足,请稍后再试"); |
| | | } |
| | | CacheSite cacheSite = cacheSites.get(0); |
| | | |
| | | Long orderId = null; |
| | | String orderNo = null; |
| | | for (TaskDetl taskDetl : list) { |
| | | orderId = taskDetl.getOrderId(); |
| | | orderNo = taskDetl.getOrderNo(); |
| | | Long orderDetlId = taskDetl.getDetlId(); |
| | | |
| | | WaveSeed waveSeed = new WaveSeed(); |
| | | waveSeed.setSiteId(cacheSite.getId()); |
| | | waveSeed.setSiteNo(cacheSite.getSiteNo()); |
| | | waveSeed.setOrderDetlId(orderDetlId); |
| | | waveSeed.setTaskDetlId(taskDetl.getId()); |
| | | waveSeed.setAnfme(taskDetl.getAnfme()); |
| | | waveSeed.setWorkQty(0D); |
| | | if (!waveSeedService.save(waveSeed)) { |
| | | throw new CoolException("波次播种创建失败"); |
| | | } |
| | | } |
| | | |
| | | if(orderId == null){ |
| | | continue; |
| | | } |
| | | |
| | | cacheSite.setOrderId(orderId); |
| | | cacheSite.setOrderNo(orderNo); |
| | | cacheSite.setSiteStatus(CacheSiteStatusType.R.id); |
| | | cacheSite.setUpdateTime(new Date()); |
| | | if (!cacheSiteService.updateById(cacheSite)) { |
| | | throw new CoolException("缓存站更新失败"); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @Transactional |
| | | public void generateWave(List<Long> orderIds) { |
| | | if (orderIds == null) { |
| | | public void orderOutMergeWave(OrderOutMergeParamDto dto) { |
| | | if(dto == null){ |
| | | throw new CoolException("参数不能为空"); |
| | | } |
| | | |
| | | if (orderIds.isEmpty()) { |
| | | if (dto.getWaveId() == null) { |
| | | throw new CoolException("未生成波次"); |
| | | } |
| | | |
| | | List<OrderOutMergeParam> params = dto.getList(); |
| | | |
| | | if (params.isEmpty()) { |
| | | throw new CoolException("参数不能为空"); |
| | | } |
| | | |
| | | Long waveId = dto.getWaveId(); |
| | | |
| | | List<Long> filterParamsList = new ArrayList<>(); |
| | | List<OrderOutMergeParam> filterParams = new ArrayList<>(); |
| | | for (OrderOutMergeParam param : params) { |
| | | if (param.getLocId() == null) { |
| | | continue; |
| | | } |
| | | |
| | | if(!filterParamsList.contains(param.getLocId())){ |
| | | filterParamsList.add(param.getLocId()); |
| | | filterParams.add(param); |
| | | } |
| | | } |
| | | |
| | | HashMap<String, Double> stockMap = new HashMap<>(); |
| | | for (OrderOutMergeParam param : filterParams) { |
| | | String matUniqueKey = Utils.getMatUniqueKey(param.getMatnr(), param.getBatch(), param.getFieldParams()); |
| | | WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getStockIndex, matUniqueKey).eq(WaveDetl::getWaveId, waveId)); |
| | | if(waveDetl == null){ |
| | | throw new CoolException("波次数据不存在"); |
| | | } |
| | | |
| | | double issued = Optional.of(waveDetl.getAnfme() - waveDetl.getWorkQty()).orElse(0.0D); |
| | | if(!stockMap.containsKey(matUniqueKey)){ |
| | | stockMap.put(matUniqueKey, issued); |
| | | } |
| | | } |
| | | |
| | | HashMap<Long, List<OrderOutMergeDto>> map = new HashMap<>(); |
| | | for (OrderOutMergeParam param : filterParams) { |
| | | LocDetl locDetl = locDetlService.getById(param.getLocDetlId()); |
| | | if(locDetl == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (locDetl.getAnfme() - param.getAnfme() < 0) { |
| | | continue; |
| | | } |
| | | |
| | | OrderOutMergeDto orderOutMergeDto = new OrderOutMergeDto(); |
| | | orderOutMergeDto.sync(param); |
| | | |
| | | String matUniqueKey = Utils.getMatUniqueKey(param.getMatnr(), param.getBatch(), param.getFieldParams()); |
| | | Double issued = stockMap.get(matUniqueKey); |
| | | if (issued - orderOutMergeDto.getAnfme() < 0) { |
| | | orderOutMergeDto.setAnfme(issued); |
| | | issued = 0D; |
| | | }else { |
| | | issued -= orderOutMergeDto.getAnfme(); |
| | | } |
| | | stockMap.put(matUniqueKey, issued); |
| | | |
| | | List<OrderOutMergeDto> list = null; |
| | | if (map.containsKey(orderOutMergeDto.getLocId())) { |
| | | list = map.get(orderOutMergeDto.getLocId()); |
| | | }else { |
| | | list = new ArrayList<>(); |
| | | } |
| | | list.add(orderOutMergeDto); |
| | | map.put(orderOutMergeDto.getLocId(), list); |
| | | } |
| | | |
| | | for (Map.Entry<Long, List<OrderOutMergeDto>> entry : map.entrySet()) { |
| | | Long locId = entry.getKey(); |
| | | List<OrderOutMergeDto> list = entry.getValue(); |
| | | Boolean all = outUtils.isAllForMerge(locId, list); |
| | | OrderOutMergeDto param = list.get(0); |
| | | Long operationPortId = param.getOperationPort(); |
| | | |
| | | Loc loc = locService.getById(locId); |
| | | if (loc == null) { |
| | | throw new CoolException("库位不存在"); |
| | | } |
| | | |
| | | if (!loc.getLocStsId().equals(LocStsType.F.val())) { |
| | | throw new CoolException(loc.getLocNo() + "库位状态异常"); |
| | | } |
| | | |
| | | OperationPort operationPort = operationPortService.getById(operationPortId); |
| | | if (operationPort == null) { |
| | | throw new CoolException("作业口不存在"); |
| | | } |
| | | |
| | | long taskType = all ? 101L : 103L; |
| | | |
| | | Task task = new Task(); |
| | | task.setTaskNo(workService.generateTaskNo(taskType)); |
| | | task.setTaskSts(101L); |
| | | task.setTaskType(taskType); |
| | | task.setIoPri(workService.generateIoPri(taskType)); |
| | | task.setOriginLoc(loc.getLocNo()); |
| | | task.setTargetSite(operationPort.getFlag()); |
| | | task.setBarcode(loc.getBarcode()); |
| | | boolean res = taskService.save(task); |
| | | if (!res) { |
| | | throw new CoolException("保存工作档失败"); |
| | | } |
| | | |
| | | for (OrderOutMergeDto merge : list) { |
| | | LocDetl locDetl = locDetlService.getById(merge.getLocDetlId()); |
| | | if(locDetl == null) { |
| | | throw new CoolException("明细不存在"); |
| | | } |
| | | |
| | | TaskDetl taskDetl = new TaskDetl(); |
| | | taskDetl.sync(locDetl); |
| | | taskDetl.setId(null); |
| | | taskDetl.setTaskId(task.getId()); |
| | | taskDetl.setTaskNo(task.getTaskNo()); |
| | | taskDetl.setAnfme(merge.getAnfme()); |
| | | taskDetl.setStock(locDetl.getAnfme()); |
| | | taskDetl.setWaveId(waveId); |
| | | taskDetl.setOrderId(null); |
| | | taskDetl.setOrderNo(null); |
| | | 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.setId(null); |
| | | taskDetlField.setDetlId(taskDetl.getId()); |
| | | boolean taskDetlFieldSave = taskDetlFieldService.save(taskDetlField); |
| | | if(!taskDetlFieldSave){ |
| | | throw new CoolException("明细扩展生成失败"); |
| | | } |
| | | } |
| | | |
| | | String matUniqueKey = Utils.getMatUniqueKey(taskDetl.getMatnr(), taskDetl.getBatch(), taskDetl.getUniqueField()); |
| | | WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getStockIndex, matUniqueKey).eq(WaveDetl::getWaveId, waveId)); |
| | | if (waveDetl == null) { |
| | | throw new CoolException("波次数据不存在"); |
| | | } |
| | | waveDetl.setWorkQty(waveDetl.getWorkQty() + taskDetl.getAnfme()); |
| | | waveDetl.setUpdateTime(new Date()); |
| | | if (!waveDetlService.updateById(waveDetl)) { |
| | | throw new CoolException("波次数据更新失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | //库位F => R |
| | | loc.setLocStsId(LocStsType.R.val()); |
| | | loc.setUpdateTime(new Date()); |
| | | boolean locUpdate = locService.updateById(loc); |
| | | if(!locUpdate){ |
| | | throw new CoolException("库位状态更新失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | Wave wave = waveService.getById(waveId); |
| | | if (wave == null) { |
| | | throw new CoolException("波次不存在"); |
| | | } |
| | | |
| | | wave.setWaveStatus(WaveStatusType.GENERATE.id); |
| | | wave.setUpdateTime(new Date()); |
| | | if (!waveService.updateById(wave)) { |
| | | throw new CoolException("波次更新失败"); |
| | | } |
| | | } |
| | | |
| | | @Transactional |
| | | public void generateWave(GenerateWaveParam param) { |
| | | if (param == null) { |
| | | throw new CoolException("参数不能为空"); |
| | | } |
| | | |
| | | List<String> channels = param.getChannels(); |
| | | if (channels == null) { |
| | | throw new CoolException("通道参数不能为空"); |
| | | } |
| | | |
| | | if (channels.isEmpty()) { |
| | | throw new CoolException("通道参数不能为空"); |
| | | } |
| | | |
| | | for (String channel : channels) { |
| | | long count = cacheSiteService.count(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getChannel, channel).ne(CacheSite::getSiteStatus, 0)); |
| | | if (count > 0) { |
| | | throw new CoolException(channel + "通道已经分配波次"); |
| | | } |
| | | } |
| | | |
| | | |
| | | List<Long> orderIds = param.getOrderIds(); |
| | | if (orderIds == null) { |
| | | throw new CoolException("订单参数不能为空"); |
| | | } |
| | | |
| | | if (orderIds.isEmpty()) { |
| | | throw new CoolException("订单参数不能为空"); |
| | | } |
| | | |
| | | List<Order> orderList = orderService.listByIds(orderIds); |
| | |
| | | Wave wave = new Wave(); |
| | | wave.setWaveNo(waveNo); |
| | | wave.setWaveType(0); |
| | | wave.setWaveStatus(WaveStatusType.INIT.id); |
| | | if (!waveService.save(wave)) { |
| | | throw new CoolException("波次生成失败"); |
| | | } |
| | | |
| | | HashMap<String, List<OrderDetl>> map = new HashMap<>(); |
| | | for (Order order : orderList) { |
| | | WaveDetl waveDetl = new WaveDetl(); |
| | | waveDetl.setWaveNo(waveNo); |
| | | waveDetl.setWaveId(wave.getId()); |
| | | waveDetl.setOrderId(order.getId()); |
| | | waveDetl.setOrderNo(order.getOrderNo()); |
| | | if (!waveDetlService.save(waveDetl)) { |
| | | throw new CoolException("波次明细生成失败"); |
| | | List<OrderDetl> orderDetls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>().eq(OrderDetl::getOrderId, order.getId())); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | List<OrderDetl> list = map.get(orderDetl.getStockIndex()); |
| | | if (list == null) { |
| | | list = new ArrayList<>(); |
| | | } |
| | | list.add(orderDetl); |
| | | map.put(orderDetl.getStockIndex(), list); |
| | | } |
| | | |
| | | order.setOrderSettle(OrderSettleType.WAVE.val()); |
| | | order.setWaveId(wave.getId()); |
| | | order.setWaveNo(waveNo); |
| | | order.setHasWave(1); |
| | | order.setUpdateTime(new Date()); |
| | | if (!orderService.updateById(order)) { |
| | | throw new CoolException("订单反写波次失败"); |
| | | } |
| | | |
| | | List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getSiteStatus, CacheSiteStatusType.O.id).in(CacheSite::getChannel, channels).orderBy(true, true, CacheSite::getChannel)); |
| | | if (cacheSites.isEmpty()) { |
| | | throw new CoolException("缓存站空间不足,请稍后再试"); |
| | | } |
| | | |
| | | CacheSite cacheSite = cacheSites.get(0); |
| | | cacheSite.setOrderId(order.getId()); |
| | | cacheSite.setOrderNo(order.getOrderNo()); |
| | | cacheSite.setSiteStatus(CacheSiteStatusType.R.id); |
| | | cacheSite.setUpdateTime(new Date()); |
| | | if (!cacheSiteService.updateById(cacheSite)) { |
| | | throw new CoolException("缓存站更新失败"); |
| | | } |
| | | } |
| | | |
| | | for (Map.Entry<String, List<OrderDetl>> entry : map.entrySet()) { |
| | | String stockIndex = entry.getKey(); |
| | | List<OrderDetl> orderDetls = entry.getValue(); |
| | | Double anfme = 0D; |
| | | Long matId = null; |
| | | String matnr = null; |
| | | String batch = null; |
| | | List<FieldParam> uniqueField = null; |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | anfme += orderDetl.getAnfme(); |
| | | matId = orderDetl.getMatId(); |
| | | matnr = orderDetl.getMat$().getMatnr(); |
| | | batch = orderDetl.getBatch(); |
| | | uniqueField = orderDetl.getUniqueField(); |
| | | } |
| | | |
| | | WaveDetl waveDetl = new WaveDetl(); |
| | | waveDetl.setWaveNo(waveNo); |
| | | waveDetl.setWaveId(wave.getId()); |
| | | waveDetl.setStockIndex(stockIndex); |
| | | waveDetl.setMatId(matId); |
| | | waveDetl.setMatnr(matnr); |
| | | waveDetl.setBatch(batch); |
| | | waveDetl.setAnfme(anfme); |
| | | waveDetl.setWorkQty(0D); |
| | | waveDetl.setFieldParams(JSON.toJSONString(uniqueField)); |
| | | if (!waveDetlService.save(waveDetl)) { |
| | | throw new CoolException("波次明细生成失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | for (Wave wave : waves) { |
| | | List<WaveDetl> waveDetls = waveDetlService.list(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getWaveId, wave.getId())); |
| | | for (WaveDetl waveDetl : waveDetls) { |
| | | Order order = orderService.getById(waveDetl.getOrderId()); |
| | | long count = taskDetlService.count(new LambdaQueryWrapper<TaskDetl>().eq(TaskDetl::getWaveId, wave.getId())); |
| | | if (count > 0) { |
| | | throw new CoolException("已存在任务,禁止取消波次"); |
| | | } |
| | | |
| | | List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getWaveId, wave.getId())); |
| | | for (Order order : orders) { |
| | | order.setWaveId(null); |
| | | order.setWaveNo(null); |
| | | order.setHasWave(0); |
| | | if(order.getOrderSettle().equals(OrderSettleType.WAVE.val())){ |
| | | order.setOrderSettle(OrderSettleType.WAIT.val()); |
| | | } |
| | | if (!orderService.updateById(order)) { |
| | | throw new CoolException("订单反写失败"); |
| | | } |
| | | |
| | | CacheSite cacheSite = cacheSiteService.getOne(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getOrderId, order.getId())); |
| | | if (cacheSite == null) { |
| | | throw new CoolException("缓存站不存在"); |
| | | } |
| | | cacheSite.setSiteStatus(CacheSiteStatusType.O.id); |
| | | cacheSite.setOrderId(null); |
| | | cacheSite.setOrderNo(null); |
| | | cacheSite.setUpdateTime(new Date()); |
| | | if (!cacheSiteService.updateById(cacheSite)) { |
| | | throw new CoolException("缓存站清空失败"); |
| | | } |
| | | } |
| | | |
| | | waveDetlService.removeById(waveDetl.getId()); |
| | | } |
| | | |
| | |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface CacheSiteMapper extends BaseMapper<CacheSite> { |
| | | |
| | | List<String> getChannelList(); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.zy.asrs.wms.asrs.entity.CacheSite; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface CacheSiteService extends IService<CacheSite> { |
| | | |
| | | List<String> getChannelList(); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service("cacheSiteService") |
| | | public class CacheSiteServiceImpl extends ServiceImpl<CacheSiteMapper, CacheSite> implements CacheSiteService { |
| | | |
| | | @Override |
| | | public List<String> getChannelList() { |
| | | return this.baseMapper.getChannelList(); |
| | | } |
| | | } |
| | |
| | | continue; |
| | | } |
| | | |
| | | if (!sortDirctLoc.contains(one.getId())) { |
| | | sortDirctLoc.add(one.getId()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | List<LocDetl> sortDirctDetls = new ArrayList<>(); |
| | | |
| | |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.asrs.wms.utils.OrderUtils; |
| | | import com.zy.asrs.wms.utils.Utils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | } |
| | | } |
| | | |
| | | orderDetl.setStockIndex(Utils.getMatUniqueKey(matnr, batch, orderDetl.getUniqueField())); |
| | | if (!orderDetlService.updateById(orderDetl)) { |
| | | throw new CoolException("更新明细索引失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | return true; |
| | |
| | | @Override |
| | | public boolean updateOrder(UpdateOrderParam param) { |
| | | Order order = this.getOne(new LambdaQueryWrapper<Order>().eq(Order::getId, param.getOrderId())); |
| | | if (order == null) { |
| | | throw new CoolException("订单不存在"); |
| | | } |
| | | |
| | | if (order.getHasWave() == 1) { |
| | | throw new CoolException("订单已经生成波次,无法修改"); |
| | | } |
| | | |
| | | order.setOrderType(param.getOrderType()); |
| | | order.setOrderSettle(param.getOrderSettle()); |
| | | order.setUpdateTime(new Date()); |
| | |
| | | } |
| | | } |
| | | |
| | | orderDetl.setStockIndex(Utils.getMatUniqueKey(matnr, batch, orderDetl.getUniqueField())); |
| | | if (!orderDetlService.updateById(orderDetl)) { |
| | | throw new CoolException("更新明细索引失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | List<Long> deleteDetlId = param.getDeleteDetlId(); |
| | |
| | | |
| | | @Override |
| | | public boolean deleteOrder(Long orderId) { |
| | | Order order = this.getById(orderId); |
| | | if (order.getHasWave() == 1) { |
| | | throw new CoolException("订单已经生成波次,删除失败"); |
| | | } |
| | | |
| | | //删除订单 |
| | | this.removeById(orderId); |
| | | //删除明细 |
| | |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | | import com.zy.asrs.wms.utils.LocUtils; |
| | | import com.zy.asrs.wms.utils.OrderUtils; |
| | | import com.zy.asrs.wms.utils.Utils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private MatService matService; |
| | | @Autowired |
| | | private OrderUtils orderUtils; |
| | | @Autowired |
| | | private WaveDetlService waveDetlService; |
| | | |
| | | @Override |
| | | public String generateTaskNo(Long taskType) { |
| | |
| | | task.setTaskSts(99L);//99.入库完成 |
| | | }else { |
| | | //出库 |
| | | TaskDetl taskDetl = taskDetls.get(0); |
| | | if (taskDetl.getWaveId() == null) { |
| | | task.setTaskSts(199L);//199.出库完成 |
| | | }else { |
| | | task.setTaskSts(198L);//198.播种中 |
| | | } |
| | | } |
| | | |
| | | task.setUpdateTime(new Date()); |
| | |
| | | if(!locService.updateById(loc)){ |
| | | throw new CoolException("库位状态变更失败"); |
| | | } |
| | | |
| | | List<TaskDetl> taskDetls = taskDetlService.getTaskDetlByTaskId(taskId); |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | if (taskDetl.getWaveId() == null) { |
| | | continue; |
| | | } |
| | | |
| | | String matUniqueKey = Utils.getMatUniqueKey(taskDetl.getMatnr(), taskDetl.getBatch(), taskDetl.getUniqueField()); |
| | | WaveDetl waveDetl = waveDetlService.getOne(new LambdaQueryWrapper<WaveDetl>().eq(WaveDetl::getStockIndex, matUniqueKey).eq(WaveDetl::getWaveId, taskDetl.getWaveId())); |
| | | if(waveDetl == null){ |
| | | continue; |
| | | } |
| | | waveDetl.setWorkQty(waveDetl.getWorkQty() - taskDetl.getAnfme()); |
| | | waveDetl.setUpdateTime(new Date()); |
| | | if (!waveDetlService.updateById(waveDetl)) { |
| | | throw new CoolException("波次明细更新失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | break; |
| | | } |
| | | |
| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy; |
| | | import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper; |
| | | import com.zy.asrs.framework.common.DateUtils; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.asrs.entity.*; |
| | | import com.zy.asrs.wms.asrs.entity.enums.OrderSettleType; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | | import com.zy.asrs.wms.system.entity.Dict; |
| | | import com.zy.asrs.wms.system.service.DictService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private DictService dictService; |
| | | |
| | | @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, 200) |
| | | .in(Task::getTaskType, 101, 53, 57)); |
| | |
| | | return; |
| | | } |
| | | |
| | | Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, "taskLogDiffDays").eq(Dict::getStatus, 1)); |
| | | if(dict == null) { |
| | | return; |
| | | } |
| | | for (Task task : list) { |
| | | int diff = DateUtils.diff(task.getCreateTime(), new Date()); |
| | | int taskLogDiffDays = Integer.parseInt(dict.getValue()); |
| | | if (diff < taskLogDiffDays) { |
| | | continue; |
| | | } |
| | | |
| | | Long hostId = task.getHostId(); |
| | | |
| | | //保存任务历史档 |
New file |
| | |
| | | package com.zy.asrs.wms.asrs.timer; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.plugins.IgnoreStrategy; |
| | | import com.baomidou.mybatisplus.core.plugins.InterceptorIgnoreHelper; |
| | | import com.zy.asrs.framework.exception.CoolException; |
| | | import com.zy.asrs.wms.asrs.entity.*; |
| | | import com.zy.asrs.wms.asrs.entity.enums.CacheSiteStatusType; |
| | | import com.zy.asrs.wms.asrs.service.*; |
| | | import com.zy.asrs.wms.system.entity.Dict; |
| | | import com.zy.asrs.wms.system.service.DictService; |
| | | import com.zy.asrs.wms.utils.OrderUtils; |
| | | import com.zy.asrs.wms.utils.Utils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.transaction.interceptor.TransactionAspectSupport; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | |
| | | @Component |
| | | public class TaskWaveTimer { |
| | | |
| | | @Autowired |
| | | private TaskService taskService; |
| | | @Autowired |
| | | private TaskDetlService taskDetlService; |
| | | @Autowired |
| | | private OrderService orderService; |
| | | @Autowired |
| | | private OrderDetlService orderDetlService; |
| | | @Autowired |
| | | private OrderUtils orderUtils; |
| | | @Autowired |
| | | private CacheSiteService cacheSiteService; |
| | | @Autowired |
| | | private WaveSeedService waveSeedService; |
| | | @Autowired |
| | | private DictService dictService; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | @Transactional |
| | | public void taskWave() { |
| | | InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build()); |
| | | try { |
| | | Dict dict = dictService.getOne(new LambdaQueryWrapper<Dict>().eq(Dict::getFlag, "autoCreateWaveSeed").eq(Dict::getStatus, 1)); |
| | | if (dict == null) { |
| | | return; |
| | | } |
| | | String autoCreateWaveSeed = dict.getValue(); |
| | | if (!autoCreateWaveSeed.equals("true")) { |
| | | return; |
| | | } |
| | | |
| | | List<Task> taskList = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskSts, 198)); |
| | | for (Task task : taskList) { |
| | | Long hostId = task.getHostId(); |
| | | |
| | | List<TaskDetl> taskDetls = taskDetlService.list(new LambdaQueryWrapper<TaskDetl>().eq(TaskDetl::getTaskId, task.getId()).eq(TaskDetl::getHostId, hostId)); |
| | | if (taskDetls.isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | for (TaskDetl taskDetl : taskDetls) { |
| | | //分配订单 |
| | | Long waveId = taskDetl.getWaveId(); |
| | | List<Order> list = orderService.list(new LambdaQueryWrapper<Order>().eq(Order::getWaveId, waveId)); |
| | | if (list.isEmpty()) { |
| | | continue; |
| | | } |
| | | |
| | | ArrayList<Long> orderIds = new ArrayList<>(); |
| | | for (Order order : list) { |
| | | orderIds.add(order.getId()); |
| | | } |
| | | |
| | | String matUniqueKey = Utils.getMatUniqueKey(taskDetl.getMatnr(), taskDetl.getBatch(), taskDetl.getUniqueField()); |
| | | List<OrderDetl> orderDetls = orderDetlService.list(new LambdaQueryWrapper<OrderDetl>() |
| | | .in(OrderDetl::getOrderId, orderIds) |
| | | .eq(OrderDetl::getStockIndex, matUniqueKey) |
| | | .eq(OrderDetl::getHostId, hostId)); |
| | | if(orderDetls.isEmpty()){ |
| | | throw new CoolException("订单明细不存在"); |
| | | } |
| | | |
| | | Double anfme = taskDetl.getAnfme(); |
| | | for (OrderDetl orderDetl : orderDetls) { |
| | | double issued = Optional.of(orderDetl.getAnfme() - orderDetl.getQty() - orderDetl.getWorkQty()).orElse(0.0D); |
| | | if (issued <= 0.0D) { continue; } |
| | | if (anfme <= 0.0D) { break; } |
| | | |
| | | double workQty = issued; |
| | | if(anfme - issued < 0){ |
| | | workQty = anfme; |
| | | } |
| | | anfme -= workQty; |
| | | |
| | | orderUtils.updateWorkQty(orderDetl.getId(), workQty, true); |
| | | |
| | | |
| | | List<CacheSite> cacheSites = cacheSiteService.list(new LambdaQueryWrapper<CacheSite>().eq(CacheSite::getSiteStatus, CacheSiteStatusType.O.id).eq(CacheSite::getHostId, hostId)); |
| | | if (cacheSites.isEmpty()) { |
| | | throw new CoolException("缓存站空间不足,请稍后再试"); |
| | | } |
| | | CacheSite cacheSite = cacheSites.get(0); |
| | | |
| | | WaveSeed waveSeed = new WaveSeed(); |
| | | waveSeed.setSiteId(cacheSite.getId()); |
| | | waveSeed.setSiteNo(cacheSite.getSiteNo()); |
| | | waveSeed.setOrderDetlId(orderDetl.getId()); |
| | | waveSeed.setTaskDetlId(taskDetl.getId()); |
| | | waveSeed.setAnfme(taskDetl.getAnfme()); |
| | | waveSeed.setWorkQty(0D); |
| | | waveSeed.setHostId(hostId); |
| | | if (!waveSeedService.save(waveSeed)) { |
| | | throw new CoolException("波次播种创建失败"); |
| | | } |
| | | |
| | | cacheSite.setOrderId(orderDetl.getOrderId()); |
| | | cacheSite.setOrderNo(orderDetl.getOrderNo()); |
| | | cacheSite.setSiteStatus(CacheSiteStatusType.R.id); |
| | | cacheSite.setUpdateTime(new Date()); |
| | | if (!cacheSiteService.updateById(cacheSite)) { |
| | | throw new CoolException("缓存站更新失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | task.setTaskSts(199L); |
| | | task.setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("任务更新失败"); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
| | | }finally { |
| | | InterceptorIgnoreHelper.clearIgnoreStrategy(); |
| | | } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | public static final String _LINK = "-"; |
| | | |
| | | public static final String _KEY_LINK = "_"; |
| | | |
| | | public static String getMatUniqueKey(String matnr, String batch, List<FieldParam> params) { |
| | | MatUniqueObjDto dto = new MatUniqueObjDto(); |
| | | dto.setMatnr(matnr); |
| | | dto.setBatch(batch); |
| | | dto.setParams(params); |
| | | |
| | | ArrayList<FieldParam> list = new ArrayList<>(); |
| | | for (FieldParam param : params) { |
| | | FieldParam fieldParam = new FieldParam(); |
| | | list.add(fieldParam); |
| | | |
| | | String value = ""; |
| | | if (!Cools.isEmpty(param.getValue())) { |
| | | value = param.getValue().toString(); |
| | | } |
| | | |
| | | fieldParam.setName(param.getName()); |
| | | fieldParam.setType(param.getType()); |
| | | fieldParam.setValue(value); |
| | | } |
| | | dto.setParams(list); |
| | | String encode = Base64.getEncoder().encodeToString(JSON.toJSONString(dto).getBytes()); |
| | | return encode; |
| | | } |
| | |
| | | <!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.CacheSiteMapper"> |
| | | |
| | | <select id="getChannelList" resultType="string"> |
| | | select distinct channel from man_cache_site |
| | | </select> |
| | | |
| | | </mapper> |