add:pda增加普通组盘,分配入库,空载具入库,配盘直送
This commit is contained in:
@@ -28,7 +28,10 @@ const zh = {
|
||||
'平库调拨出库',
|
||||
'线边领料出库',
|
||||
'配盘出库',
|
||||
'配盘呼叫'
|
||||
'配盘呼叫',
|
||||
'分配入库',
|
||||
'空托入库',
|
||||
'配盘直送',
|
||||
// '空托上架/下架/注册/呼叫',
|
||||
// 'AGV配送',
|
||||
// '人工盘点',
|
||||
@@ -215,6 +218,9 @@ const en = {
|
||||
'Manual Inventory',
|
||||
'Staging Query',
|
||||
'Consolidation',
|
||||
'Assign Inbound',
|
||||
'Empty Pallet Inbound',
|
||||
'Direct Delivery',
|
||||
],
|
||||
},
|
||||
receiveGroup: {
|
||||
|
||||
@@ -55,6 +55,24 @@ const routes = [
|
||||
component: () => import('@/views/AgvInbound.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/assign-inbound',
|
||||
name: 'AssignInbound',
|
||||
component: () => import('@/views/AssignInbound.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/empty-vehicle-inbound',
|
||||
name: 'EmptyVehicleInbound',
|
||||
component: () => import('@/views/EmptyVehicleInbound.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/direct-delivery',
|
||||
name: 'DirectDelivery',
|
||||
component: () => import('@/views/DirectDelivery.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
},
|
||||
{
|
||||
path: '/manual-inbound',
|
||||
name: 'ManualInbound',
|
||||
|
||||
147
pda/pda/src/views/AssignInbound.vue
Normal file
147
pda/pda/src/views/AssignInbound.vue
Normal file
@@ -0,0 +1,147 @@
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<van-nav-bar title="分配入库" left-arrow @click-left="router.push('/')" />
|
||||
<div class="page-content">
|
||||
<van-cell-group inset class="scanner-card">
|
||||
<van-field
|
||||
ref="vehicleInput"
|
||||
v-model.trim="vehicleCode"
|
||||
label="托盘码"
|
||||
placeholder="请扫描或输入托盘码"
|
||||
clearable
|
||||
autofocus
|
||||
@keyup.enter="onVehicleEnter"
|
||||
>
|
||||
<template #right-icon>
|
||||
<van-icon name="scan" class="scan-icon" />
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field
|
||||
ref="sectInput"
|
||||
v-model.trim="sectCode"
|
||||
label="入库库区"
|
||||
placeholder="请扫描或输入库区码"
|
||||
clearable
|
||||
@keyup.enter="onSectEnter"
|
||||
>
|
||||
<template #right-icon>
|
||||
<van-icon name="location-o" class="scan-icon" @click="toggleSectCache" />
|
||||
</template>
|
||||
</van-field>
|
||||
</van-cell-group>
|
||||
|
||||
<van-cell-group inset v-if="sectCached" class="cache-tip">
|
||||
<van-cell title="已缓存库区" :value="cachedSectCode" is-link @click="useCachedSect" />
|
||||
</van-cell-group>
|
||||
|
||||
<div class="tips">
|
||||
扫描托盘码与库区码后提交,系统将自动分配库位并生成AGV入库任务。
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-bottom">
|
||||
<van-button type="primary" block :loading="submitting" @click="onSubmit">分配入库</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {nextTick, onMounted, ref} from 'vue'
|
||||
import {useRouter} from 'vue-router'
|
||||
import {showToast} from 'vant'
|
||||
import request from '@/utils/request'
|
||||
|
||||
const router = useRouter()
|
||||
const vehicleInput = ref()
|
||||
const sectInput = ref()
|
||||
const vehicleCode = ref('')
|
||||
const sectCode = ref('')
|
||||
const submitting = ref(false)
|
||||
|
||||
const CACHE_KEY = 'assign_inbound_sect_code'
|
||||
const cachedSectCode = ref('')
|
||||
const sectCached = ref(false)
|
||||
|
||||
onMounted(() => {
|
||||
refreshCache()
|
||||
nextTick(() => vehicleInput.value?.focus())
|
||||
})
|
||||
|
||||
function refreshCache() {
|
||||
cachedSectCode.value = localStorage.getItem(CACHE_KEY) || ''
|
||||
sectCached.value = !!cachedSectCode.value
|
||||
// 默认回填缓存库区,避免重复扫描
|
||||
if (sectCached.value && !sectCode.value) {
|
||||
sectCode.value = cachedSectCode.value
|
||||
}
|
||||
}
|
||||
|
||||
function useCachedSect() {
|
||||
sectCode.value = cachedSectCode.value
|
||||
sectInput.value?.focus()
|
||||
}
|
||||
|
||||
function toggleSectCache() {
|
||||
if (!cachedSectCode.value) {
|
||||
showToast({message: '暂无缓存库区,请扫描输入', type: 'fail'})
|
||||
return
|
||||
}
|
||||
sectCode.value = cachedSectCode.value
|
||||
}
|
||||
|
||||
function onVehicleEnter() {
|
||||
if (vehicleCode.value) sectInput.value?.focus()
|
||||
}
|
||||
|
||||
async function onSectEnter() {
|
||||
if (sectCode.value && vehicleCode.value) await onSubmit()
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
if (submitting.value) return
|
||||
if (!vehicleCode.value) {
|
||||
showToast({message: '请扫描托盘码', type: 'fail'})
|
||||
vehicleInput.value?.focus()
|
||||
return
|
||||
}
|
||||
if (!sectCode.value) {
|
||||
showToast({message: '请扫描库区码', type: 'fail'})
|
||||
sectInput.value?.focus()
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
await request.post('/api/pda/iosIn/assignInbound', {
|
||||
vehicle_code: vehicleCode.value,
|
||||
sect_code: sectCode.value,
|
||||
})
|
||||
showToast({message: '入库任务已生成', type: 'success'})
|
||||
// 缓存库区码,下次进入自动带出
|
||||
localStorage.setItem(CACHE_KEY, sectCode.value)
|
||||
vehicleCode.value = ''
|
||||
refreshCache()
|
||||
nextTick(() => vehicleInput.value?.focus())
|
||||
} catch {
|
||||
// 请求拦截器统一提示错误
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.scanner-card {
|
||||
margin: 12px 0;
|
||||
border: 1px solid #dfe7e8;
|
||||
}
|
||||
|
||||
.cache-tip {
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
|
||||
.tips {
|
||||
margin: 6px 4px;
|
||||
color: #87989a;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
</style>
|
||||
386
pda/pda/src/views/DirectDelivery.vue
Normal file
386
pda/pda/src/views/DirectDelivery.vue
Normal file
@@ -0,0 +1,386 @@
|
||||
<template>
|
||||
<div class="page-container direct-page">
|
||||
<van-nav-bar title="配盘直送" left-arrow @click-left="router.push('/')" />
|
||||
<div class="page-content">
|
||||
<!-- 产线选择 -->
|
||||
<van-cell-group inset class="scanner-card">
|
||||
<van-field
|
||||
v-model="regionName"
|
||||
is-link
|
||||
readonly
|
||||
label="产线"
|
||||
placeholder="请选择产线区域"
|
||||
@click="showRegionPicker = true"
|
||||
/>
|
||||
</van-cell-group>
|
||||
<van-popup v-model:show="showRegionPicker" position="bottom" round>
|
||||
<van-picker
|
||||
:columns="regionColumns"
|
||||
@confirm="onRegionConfirm"
|
||||
@cancel="showRegionPicker = false"
|
||||
/>
|
||||
</van-popup>
|
||||
|
||||
<!-- 工单多选 -->
|
||||
<div class="section-header">
|
||||
<span>工单(已选 {{ selectedOrders.length }}/{{ workOrders.length }})</span>
|
||||
<span class="refresh" @click="loadWorkOrders">刷新</span>
|
||||
</div>
|
||||
<van-empty v-if="regionCode && !loadingOrders && !workOrders.length" description="该产线暂无可直送工单" />
|
||||
<van-empty v-if="!regionCode" description="请先选择产线" />
|
||||
<van-checkbox-group v-model="selectedOrders">
|
||||
<van-cell-group inset v-if="workOrders.length" class="order-card">
|
||||
<van-cell
|
||||
v-for="order in workOrders"
|
||||
:key="order.order_code"
|
||||
:title="order.order_code"
|
||||
:label="order.plan_started_on ? '计划开工:' + order.plan_started_on : '-'"
|
||||
clickable
|
||||
@click="toggleOrder(order.order_code)"
|
||||
>
|
||||
<template #right-icon>
|
||||
<van-checkbox :name="order.order_code" @click.stop />
|
||||
</template>
|
||||
<template #value>
|
||||
<span class="order-qty">×{{ order.order_qty ?? '-' }}</span>
|
||||
</template>
|
||||
</van-cell>
|
||||
</van-cell-group>
|
||||
</van-checkbox-group>
|
||||
|
||||
<!-- 上料口扫描 -->
|
||||
<van-cell-group inset class="scanner-card">
|
||||
<van-field
|
||||
ref="loadPortInput"
|
||||
v-model.trim="loadPort"
|
||||
label="上料口"
|
||||
placeholder="请扫描或输入上料口编码"
|
||||
clearable
|
||||
@keyup.enter="queryMaterials"
|
||||
>
|
||||
<template #right-icon>
|
||||
<van-icon name="scan" class="scan-icon" @click="queryMaterials" />
|
||||
</template>
|
||||
</van-field>
|
||||
</van-cell-group>
|
||||
|
||||
<!-- BOM物料明细 -->
|
||||
<div v-if="materials.length" class="section-header">
|
||||
<span>物料明细({{ currentPort }})</span>
|
||||
<span>{{ materials.length }} 种物料</span>
|
||||
</div>
|
||||
<div v-if="materials.length" class="material-card">
|
||||
<div v-for="item in materials" :key="item.material_code" class="material-row">
|
||||
<div>
|
||||
<strong>{{ item.material_code }}</strong>
|
||||
<div class="material-name">{{ item.material_name || '-' }}</div>
|
||||
</div>
|
||||
<div class="material-qty">
|
||||
<div>需求 {{ item.need_qty }} {{ item.unit || '' }}</div>
|
||||
<div class="remain">剩余 {{ item.remain_qty }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- AGV配送开关 -->
|
||||
<van-cell-group inset class="scanner-card">
|
||||
<van-cell center title="AGV配送">
|
||||
<template #right-icon>
|
||||
<van-switch v-model="agvDelivery" size="22" />
|
||||
</template>
|
||||
</van-cell>
|
||||
<van-field
|
||||
ref="vehicleInput"
|
||||
v-model.trim="vehicleCode"
|
||||
label="托盘码"
|
||||
placeholder="请扫描或输入托盘码"
|
||||
clearable
|
||||
@keyup.enter="onVehicleEnter"
|
||||
>
|
||||
<template #right-icon>
|
||||
<van-icon name="scan" class="scan-icon" />
|
||||
</template>
|
||||
</van-field>
|
||||
</van-cell-group>
|
||||
|
||||
<div class="tips">
|
||||
组盘状态的托盘不入库直接配送:生成出库单与LLCK回传EAS;开启AGV配送时自动生成点对点搬运任务。
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-bottom">
|
||||
<van-button type="primary" block :loading="submitting" @click="onSubmit">确认直送</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {computed, nextTick, onMounted, ref, watch} from 'vue'
|
||||
import {useRouter} from 'vue-router'
|
||||
import {showConfirmDialog, showToast} from 'vant'
|
||||
import request from '@/utils/request'
|
||||
|
||||
const router = useRouter()
|
||||
const loadPortInput = ref()
|
||||
const vehicleInput = ref()
|
||||
|
||||
const regions = ref([])
|
||||
const regionCode = ref('')
|
||||
const regionName = ref('')
|
||||
const showRegionPicker = ref(false)
|
||||
|
||||
const workOrders = ref([])
|
||||
const selectedOrders = ref([])
|
||||
const loadingOrders = ref(false)
|
||||
|
||||
const loadPort = ref('')
|
||||
const currentPort = ref('')
|
||||
const materials = ref([])
|
||||
const loadingMaterials = ref(false)
|
||||
|
||||
const agvDelivery = ref(true)
|
||||
const vehicleCode = ref('')
|
||||
const submitting = ref(false)
|
||||
|
||||
const REGION_CACHE_KEY = 'direct_delivery_region_code'
|
||||
|
||||
const regionColumns = computed(() => {
|
||||
if (!regions.value.length) return [{text: '加载中...', value: ''}]
|
||||
return regions.value.map(r => ({text: r.region_name || r.region_code, value: r.region_code}))
|
||||
})
|
||||
|
||||
onMounted(async () => {
|
||||
try {
|
||||
const res = await request.get('/api/pda/directDelivery/regions')
|
||||
regions.value = res.data || []
|
||||
} catch {
|
||||
// 请求拦截器统一提示错误
|
||||
}
|
||||
// 回填缓存产线
|
||||
const cachedCode = localStorage.getItem(REGION_CACHE_KEY)
|
||||
if (cachedCode) {
|
||||
const cached = regions.value.find(r => r.region_code === cachedCode)
|
||||
if (cached) {
|
||||
regionCode.value = cached.region_code
|
||||
regionName.value = cached.region_name || cached.region_code
|
||||
await loadWorkOrders()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
function onRegionConfirm({selectedOptions}) {
|
||||
const option = selectedOptions[0]
|
||||
if (!option || !option.value) {
|
||||
showRegionPicker.value = false
|
||||
return
|
||||
}
|
||||
regionCode.value = option.value
|
||||
regionName.value = option.text
|
||||
localStorage.setItem(REGION_CACHE_KEY, option.value)
|
||||
showRegionPicker.value = false
|
||||
loadWorkOrders()
|
||||
}
|
||||
|
||||
watch(regionCode, () => {
|
||||
selectedOrders.value = []
|
||||
resetMaterials()
|
||||
})
|
||||
|
||||
async function loadWorkOrders() {
|
||||
if (!regionCode.value || loadingOrders.value) return
|
||||
loadingOrders.value = true
|
||||
try {
|
||||
const res = await request.get('/api/pda/directDelivery/workOrders', {
|
||||
params: {regionCode: regionCode.value},
|
||||
})
|
||||
workOrders.value = res.data || []
|
||||
} catch {
|
||||
workOrders.value = []
|
||||
} finally {
|
||||
loadingOrders.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function toggleOrder(code) {
|
||||
const index = selectedOrders.value.indexOf(code)
|
||||
if (index >= 0) {
|
||||
selectedOrders.value.splice(index, 1)
|
||||
} else {
|
||||
selectedOrders.value.push(code)
|
||||
}
|
||||
}
|
||||
|
||||
async function queryMaterials() {
|
||||
if (loadingMaterials.value) return
|
||||
const port = loadPort.value.trim()
|
||||
if (!port) {
|
||||
showToast({message: '请扫描上料口', type: 'fail'})
|
||||
return
|
||||
}
|
||||
if (!selectedOrders.value.length) {
|
||||
showToast({message: '请先选择工单', type: 'fail'})
|
||||
return
|
||||
}
|
||||
loadingMaterials.value = true
|
||||
try {
|
||||
const res = await request.get('/api/pda/directDelivery/bomMaterials', {
|
||||
params: {loadPort: port, workOrders: selectedOrders.value.join(',')},
|
||||
})
|
||||
currentPort.value = port
|
||||
materials.value = res.data || []
|
||||
if (!materials.value.length) {
|
||||
showToast({message: '所选工单在该上料口无BOM物料', type: 'fail'})
|
||||
} else {
|
||||
nextTick(() => vehicleInput.value?.focus())
|
||||
}
|
||||
} catch {
|
||||
materials.value = []
|
||||
} finally {
|
||||
loadingMaterials.value = false
|
||||
}
|
||||
}
|
||||
|
||||
watch(loadPort, () => {
|
||||
if (loadPort.value.trim() !== currentPort.value) resetMaterials()
|
||||
})
|
||||
|
||||
function resetMaterials() {
|
||||
materials.value = []
|
||||
currentPort.value = ''
|
||||
}
|
||||
|
||||
function onVehicleEnter() {
|
||||
if (vehicleCode.value) onSubmit()
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
if (submitting.value) return
|
||||
if (!selectedOrders.value.length) {
|
||||
showToast({message: '请先选择工单', type: 'fail'})
|
||||
return
|
||||
}
|
||||
if (!loadPort.value.trim()) {
|
||||
showToast({message: '请扫描上料口', type: 'fail'})
|
||||
loadPortInput.value?.focus()
|
||||
return
|
||||
}
|
||||
if (!materials.value.length) {
|
||||
showToast({message: '请先扫描上料口查询物料明细', type: 'fail'})
|
||||
return
|
||||
}
|
||||
if (!vehicleCode.value.trim()) {
|
||||
showToast({message: '请扫描托盘码', type: 'fail'})
|
||||
vehicleInput.value?.focus()
|
||||
return
|
||||
}
|
||||
try {
|
||||
await showConfirmDialog({
|
||||
title: '确认直送',
|
||||
message: `托盘 ${vehicleCode.value} 直送 ${loadPort.value.trim()},出库单将生成并回传LLCK${agvDelivery.value ? ',同时生成AGV配送任务' : ''},确认提交?`,
|
||||
})
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
const res = await request.post('/api/pda/directDelivery/deliver', {
|
||||
region_code: regionCode.value,
|
||||
workOrders: selectedOrders.value,
|
||||
load_port: loadPort.value.trim(),
|
||||
vehicle_code: vehicleCode.value.trim(),
|
||||
agv_delivery: agvDelivery.value,
|
||||
})
|
||||
const data = res.data || {}
|
||||
let message = '直送完成'
|
||||
if (data.bill_code) message += `,出库单 ${data.bill_code}`
|
||||
if (data.task_code) message += `,任务 ${data.task_code}`
|
||||
showToast({message, type: 'success'})
|
||||
vehicleCode.value = ''
|
||||
await loadWorkOrders()
|
||||
await queryMaterials()
|
||||
} catch {
|
||||
// 请求拦截器统一提示错误
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.direct-page {
|
||||
background: #eef2f3;
|
||||
}
|
||||
|
||||
.scanner-card {
|
||||
margin: 12px 0;
|
||||
border: 1px solid #dfe7e8;
|
||||
}
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 4px 2px 8px;
|
||||
color: #587073;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.refresh {
|
||||
color: #1989fa;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.order-card {
|
||||
margin-bottom: 12px;
|
||||
}
|
||||
|
||||
.order-qty {
|
||||
color: #d36b2c;
|
||||
}
|
||||
|
||||
.material-card {
|
||||
margin-bottom: 14px;
|
||||
padding: 12px 16px;
|
||||
background: #fff;
|
||||
border-left: 5px solid #1989fa;
|
||||
border-radius: 4px 12px 12px 4px;
|
||||
box-shadow: 0 5px 18px rgba(39, 68, 72, 0.08);
|
||||
}
|
||||
|
||||
.material-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
min-height: 48px;
|
||||
padding: 5px 0;
|
||||
border-bottom: 1px dashed #e7ecec;
|
||||
}
|
||||
|
||||
.material-row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.material-name {
|
||||
margin-top: 3px;
|
||||
color: #87989a;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.material-qty {
|
||||
flex-shrink: 0;
|
||||
margin-left: 12px;
|
||||
text-align: right;
|
||||
color: #587073;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.remain {
|
||||
color: #d36b2c;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.tips {
|
||||
margin: 6px 4px;
|
||||
color: #87989a;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
</style>
|
||||
161
pda/pda/src/views/EmptyVehicleInbound.vue
Normal file
161
pda/pda/src/views/EmptyVehicleInbound.vue
Normal file
@@ -0,0 +1,161 @@
|
||||
<template>
|
||||
<div class="page-container">
|
||||
<van-nav-bar title="空托入库" left-arrow @click-left="router.push('/')" />
|
||||
<div class="page-content">
|
||||
<van-cell-group inset class="scanner-card">
|
||||
<van-field
|
||||
ref="vehicleInput"
|
||||
v-model.trim="vehicleCode"
|
||||
label="托盘码"
|
||||
placeholder="请扫描或输入托盘码"
|
||||
clearable
|
||||
autofocus
|
||||
@keyup.enter="onVehicleEnter"
|
||||
>
|
||||
<template #right-icon>
|
||||
<van-icon name="scan" class="scan-icon" />
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field
|
||||
ref="siteInput"
|
||||
v-model.trim="siteCode"
|
||||
label="地面站点"
|
||||
placeholder="请扫描或输入地面站点码"
|
||||
clearable
|
||||
@keyup.enter="onSiteEnter"
|
||||
>
|
||||
<template #right-icon>
|
||||
<van-icon name="scan" class="scan-icon" />
|
||||
</template>
|
||||
</van-field>
|
||||
<van-field
|
||||
ref="sectInput"
|
||||
v-model.trim="sectCode"
|
||||
label="目标库区"
|
||||
placeholder="请扫描或输入目标库区码"
|
||||
clearable
|
||||
@keyup.enter="onSectEnter"
|
||||
>
|
||||
<template #right-icon>
|
||||
<van-icon name="location-o" class="scan-icon" @click="fillCachedSect" />
|
||||
</template>
|
||||
</van-field>
|
||||
</van-cell-group>
|
||||
|
||||
<van-cell-group inset v-if="cachedSectCode" class="cache-tip">
|
||||
<van-cell title="已缓存库区" :value="cachedSectCode" is-link @click="fillCachedSect" />
|
||||
</van-cell-group>
|
||||
|
||||
<div class="tips">
|
||||
空载具入库不生成出入库单据:系统自动分配空库位,生成从地面站点到库位的AGV搬运任务。
|
||||
</div>
|
||||
</div>
|
||||
<div class="page-bottom">
|
||||
<van-button type="primary" block :loading="submitting" @click="onSubmit">空托入库</van-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import {nextTick, onMounted, ref} from 'vue'
|
||||
import {useRouter} from 'vue-router'
|
||||
import {showToast} from 'vant'
|
||||
import request from '@/utils/request'
|
||||
|
||||
const router = useRouter()
|
||||
const vehicleInput = ref()
|
||||
const siteInput = ref()
|
||||
const sectInput = ref()
|
||||
const vehicleCode = ref('')
|
||||
const siteCode = ref('')
|
||||
const sectCode = ref('')
|
||||
const submitting = ref(false)
|
||||
|
||||
const CACHE_KEY = 'empty_vehicle_inbound_sect_code'
|
||||
const cachedSectCode = ref('')
|
||||
|
||||
onMounted(() => {
|
||||
cachedSectCode.value = localStorage.getItem(CACHE_KEY) || ''
|
||||
// 默认回填缓存库区,避免重复扫描
|
||||
if (cachedSectCode.value && !sectCode.value) {
|
||||
sectCode.value = cachedSectCode.value
|
||||
}
|
||||
nextTick(() => vehicleInput.value?.focus())
|
||||
})
|
||||
|
||||
function fillCachedSect() {
|
||||
if (!cachedSectCode.value) {
|
||||
showToast({message: '暂无缓存库区,请扫描输入', type: 'fail'})
|
||||
return
|
||||
}
|
||||
sectCode.value = cachedSectCode.value
|
||||
sectInput.value?.focus()
|
||||
}
|
||||
|
||||
function onVehicleEnter() {
|
||||
if (vehicleCode.value) siteInput.value?.focus()
|
||||
}
|
||||
|
||||
function onSiteEnter() {
|
||||
if (siteCode.value) sectInput.value?.focus()
|
||||
}
|
||||
|
||||
async function onSectEnter() {
|
||||
if (sectCode.value && siteCode.value && vehicleCode.value) await onSubmit()
|
||||
}
|
||||
|
||||
async function onSubmit() {
|
||||
if (submitting.value) return
|
||||
if (!vehicleCode.value) {
|
||||
showToast({message: '请扫描托盘码', type: 'fail'})
|
||||
vehicleInput.value?.focus()
|
||||
return
|
||||
}
|
||||
if (!siteCode.value) {
|
||||
showToast({message: '请扫描地面站点码', type: 'fail'})
|
||||
siteInput.value?.focus()
|
||||
return
|
||||
}
|
||||
if (!sectCode.value) {
|
||||
showToast({message: '请扫描目标库区码', type: 'fail'})
|
||||
sectInput.value?.focus()
|
||||
return
|
||||
}
|
||||
submitting.value = true
|
||||
try {
|
||||
await request.post('/api/pda/iosIn/emptyVehicleInbound', {
|
||||
vehicle_code: vehicleCode.value,
|
||||
site_code: siteCode.value,
|
||||
sect_code: sectCode.value,
|
||||
})
|
||||
showToast({message: '空托入库任务已生成', type: 'success'})
|
||||
// 缓存库区码,下次进入自动带出
|
||||
localStorage.setItem(CACHE_KEY, sectCode.value)
|
||||
vehicleCode.value = ''
|
||||
siteCode.value = ''
|
||||
nextTick(() => vehicleInput.value?.focus())
|
||||
} catch {
|
||||
// 请求拦截器统一提示错误
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.scanner-card {
|
||||
margin: 12px 0;
|
||||
border: 1px solid #dfe7e8;
|
||||
}
|
||||
|
||||
.cache-tip {
|
||||
margin: 0 0 12px;
|
||||
}
|
||||
|
||||
.tips {
|
||||
margin: 6px 4px;
|
||||
color: #87989a;
|
||||
font-size: 13px;
|
||||
line-height: 1.6;
|
||||
}
|
||||
</style>
|
||||
@@ -45,6 +45,9 @@ const menuIcons = [
|
||||
'bag-o',
|
||||
'apps-o',
|
||||
'phone-circle-o',
|
||||
'send-gift-o',
|
||||
'cart-o',
|
||||
'guide-o',
|
||||
]
|
||||
|
||||
const menuRoutes = {
|
||||
@@ -58,6 +61,9 @@ const menuRoutes = {
|
||||
7: '/developing',
|
||||
8: '/plating-demand',
|
||||
9: '/plating-call',
|
||||
10: '/assign-inbound',
|
||||
11: '/empty-vehicle-inbound',
|
||||
12: '/direct-delivery',
|
||||
}
|
||||
|
||||
function onMenuClick(index) {
|
||||
|
||||
Reference in New Issue
Block a user