4 changed files with 372 additions and 0 deletions
-
16src/api/automatedWarehouse/emptyPalletAssembly.js
-
1src/router/index.js
-
6src/views/main.vue
-
349src/views/modules/automatedWarehouse/emptyPalletAssembly.vue
@ -0,0 +1,16 @@ |
|||
import { createAPI } from "@/utils/httpRequest.js"; |
|||
|
|||
// ========== 空托盘组盘相关 ========== - rqrq
|
|||
|
|||
// 检查是否为空托盘(pallet_detail表无数据)- rqrq
|
|||
export const checkEmptyPallet = data => createAPI(`/wcsIntegration/checkEmptyPallet`, 'post', data) |
|||
|
|||
// 获取托盘类型列表 - rqrq
|
|||
export const getPalletTypes = data => createAPI(`/wcsIntegration/getPalletTypes`, 'post', data) |
|||
|
|||
// 更新托盘类型和自动分拣标志 - rqrq
|
|||
export const updatePalletTypeAndAutoSort = data => createAPI(`/wcsIntegration/updatePalletTypeAndAutoSort`, 'post', data) |
|||
|
|||
// 空托盘通知入库(包含入库并运输)- rqrq
|
|||
export const notifyEmptyPalletInbound = data => createAPI(`/wcsIntegration/notifyEmptyPalletInbound`, 'post', data) |
|||
|
|||
@ -0,0 +1,349 @@ |
|||
<template> |
|||
<div> |
|||
<div class="pda-container"> |
|||
<!-- 头部栏 - rqrq --> |
|||
<div class="header-bar"> |
|||
<div class="header-left" @click="handleBack"> |
|||
<i class="el-icon-arrow-left"></i> |
|||
<span>空托盘组盘</span> |
|||
</div> |
|||
<div class="header-right" @click="$router.push({ path: '/' })"> |
|||
首页 |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="table-body" style="max-height: 600px; overflow-y: auto;"> |
|||
<div class="main-content form-section"> |
|||
<!-- 栈板扫描 - rqrq --> |
|||
<div class="input-group"> |
|||
<label class="input-label">托盘编码</label> |
|||
<el-input |
|||
v-model="palletCode" |
|||
placeholder="请扫描托盘编码" |
|||
class="form-input" |
|||
clearable |
|||
@keyup.enter.native="handlePalletScan" |
|||
ref="palletInput" |
|||
/> |
|||
</div> |
|||
|
|||
<!-- 托盘信息显示(扫描托盘后显示)- rqrq --> |
|||
<div v-if="palletScanned" class="pallet-info-section"> |
|||
<!-- 托盘类型选择 - rqrq --> |
|||
<div class="input-group"> |
|||
<label class="input-label">托盘类型</label> |
|||
<el-select |
|||
v-model="currentPalletType" |
|||
placeholder="请选择托盘类型" |
|||
style="width: 100%;" |
|||
@change="handlePalletTypeChange" |
|||
> |
|||
<el-option |
|||
v-for="type in palletTypeOptions" |
|||
:key="type.palletType" |
|||
:label="`${type.palletType} - ${type.typeDesc}`" |
|||
:value="type.palletType" |
|||
/> |
|||
</el-select> |
|||
</div> |
|||
|
|||
<!-- 当前站点信息 - rqrq --> |
|||
<div class="info-row"> |
|||
<label class="info-label">当前站点ID:</label> |
|||
<span class="info-value">{{ palletInfo.currentStationId || '-' }}</span> |
|||
</div> |
|||
|
|||
<div class="info-row"> |
|||
<label class="info-label">当前站点编码:</label> |
|||
<span class="info-value">{{ palletInfo.currentStationCode || '-' }}</span> |
|||
</div> |
|||
|
|||
<!-- 操作按钮 - rqrq --> |
|||
<div class="button-row" style="display: flex; gap: 8px; margin-top: 16px;"> |
|||
<button |
|||
class="action-btn primary" |
|||
@click="handleNotifyInbound" |
|||
:disabled="notifyLoading || !currentPalletType" |
|||
style="flex: 1;"> |
|||
{{ notifyLoading ? '处理中...' : '通知入库' }} |
|||
</button> |
|||
<button |
|||
class="action-btn primary" |
|||
@click="handleInboundAndTransport" |
|||
:disabled="transportLoading || !currentPalletType" |
|||
style="flex: 1;"> |
|||
{{ transportLoading ? '处理中...' : '入库并运输' }} |
|||
</button> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { |
|||
checkEmptyPallet, |
|||
getPalletTypes, |
|||
updatePalletTypeAndAutoSort, |
|||
notifyEmptyPalletInbound |
|||
} from '../../../api/automatedWarehouse/emptyPalletAssembly' |
|||
|
|||
export default { |
|||
data() { |
|||
return { |
|||
site: localStorage.getItem('site'), |
|||
|
|||
// 托盘信息 - rqrq |
|||
palletCode: '', |
|||
palletScanned: false, |
|||
palletInfo: { |
|||
currentStationId: '', |
|||
currentStationCode: '', |
|||
palletType: '' |
|||
}, |
|||
|
|||
// 托盘类型 - rqrq |
|||
currentPalletType: '', |
|||
palletTypeOptions: [], |
|||
|
|||
// 加载状态 - rqrq |
|||
notifyLoading: false, |
|||
transportLoading: false |
|||
}; |
|||
}, |
|||
methods: { |
|||
// 返回上一页 - rqrq |
|||
handleBack() { |
|||
this.$router.back(); |
|||
}, |
|||
|
|||
// 扫描托盘 - rqrq |
|||
handlePalletScan() { |
|||
if (!this.palletCode.trim()) { |
|||
this.$message.error('请输入托盘编码'); |
|||
return; |
|||
} |
|||
|
|||
checkEmptyPallet({ |
|||
site: this.site, |
|||
palletId: this.palletCode |
|||
}).then(({ data }) => { |
|||
if (data.code === 0) { |
|||
// 托盘信息 - rqrq |
|||
this.palletInfo = data.row; |
|||
this.currentPalletType = data.row.palletType || ''; |
|||
this.palletScanned = true; |
|||
|
|||
// 根据托盘的palletFamily加载托盘类型选项 - rqrq |
|||
this.loadPalletTypes(data.row.palletFamily); |
|||
|
|||
} else { |
|||
this.$alert(data.msg || '托盘验证失败', '错误', { |
|||
confirmButtonText: '确定', |
|||
callback: () => { |
|||
this.palletCode = ''; |
|||
this.$nextTick(() => { |
|||
if (this.$refs.palletInput) { |
|||
this.$refs.palletInput.focus(); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
} |
|||
}).catch(error => { |
|||
console.error('查询托盘失败:', error); |
|||
this.$alert(error.message || '查询托盘失败', '错误', { |
|||
confirmButtonText: '确定', |
|||
callback: () => { |
|||
this.palletCode = ''; |
|||
this.$nextTick(() => { |
|||
if (this.$refs.palletInput) { |
|||
this.$refs.palletInput.focus(); |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
}); |
|||
}, |
|||
|
|||
// 加载托盘类型选项(根据palletFamily过滤)- rqrq |
|||
loadPalletTypes(palletFamily) { |
|||
getPalletTypes({ |
|||
site: this.site, |
|||
palletFamily: palletFamily || '' |
|||
}).then(({ data }) => { |
|||
if (data.code === 0) { |
|||
this.palletTypeOptions = data.rows || []; |
|||
} else { |
|||
this.palletTypeOptions = []; |
|||
this.$message.error('获取托盘类型失败'); |
|||
} |
|||
}).catch(error => { |
|||
console.error('获取托盘类型失败:', error); |
|||
this.palletTypeOptions = []; |
|||
}); |
|||
}, |
|||
|
|||
// 托盘类型变更事件 - rqrq |
|||
handlePalletTypeChange() { |
|||
// 保存到数据库 - rqrq |
|||
updatePalletTypeAndAutoSort({ |
|||
site: this.site, |
|||
palletId: this.palletCode, |
|||
palletType: this.currentPalletType, |
|||
autoSort: 'N', |
|||
forceFullPalletOut: false |
|||
}).then(({ data }) => { |
|||
if (data.code === 0) { |
|||
this.$message.success('更新成功'); |
|||
} else { |
|||
this.$message.error(data.msg || '更新失败'); |
|||
} |
|||
}).catch(error => { |
|||
console.error('更新失败:', error); |
|||
this.$message.error('更新失败'); |
|||
}); |
|||
}, |
|||
|
|||
// 通知入库 - rqrq |
|||
handleNotifyInbound() { |
|||
if (!this.currentPalletType) { |
|||
this.$message.error('请先选择托盘类型'); |
|||
return; |
|||
} |
|||
|
|||
this.$confirm('确定要执行通知入库操作吗?', '确认操作', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
this.notifyLoading = true; |
|||
|
|||
notifyEmptyPalletInbound({ |
|||
site: this.site, |
|||
palletId: this.palletCode, |
|||
transportFlag: 'N' |
|||
}).then(({ data }) => { |
|||
if (data && data.code === 0) { |
|||
this.$message.success('通知入库成功'); |
|||
// 清空页面重新扫描 - rqrq |
|||
this.resetPage(); |
|||
} else { |
|||
this.$alert(data.msg || '通知入库失败', '错误'); |
|||
} |
|||
}).catch(error => { |
|||
console.error('通知入库失败:', error); |
|||
this.$message.error(error.message || '通知入库失败'); |
|||
}).finally(() => { |
|||
this.notifyLoading = false; |
|||
}); |
|||
}).catch(() => { |
|||
// 用户取消操作 |
|||
}); |
|||
}, |
|||
|
|||
// 入库并运输 - rqrq |
|||
handleInboundAndTransport() { |
|||
if (!this.currentPalletType) { |
|||
this.$message.error('请先选择托盘类型'); |
|||
return; |
|||
} |
|||
|
|||
this.$confirm('确定要执行入库并运输操作吗?', '确认操作', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
this.transportLoading = true; |
|||
|
|||
notifyEmptyPalletInbound({ |
|||
site: this.site, |
|||
palletId: this.palletCode, |
|||
transportFlag: 'Y' |
|||
}).then(({ data }) => { |
|||
if (data && data.code === 0) { |
|||
this.$message.success('入库并运输成功'); |
|||
// 清空页面重新扫描 - rqrq |
|||
this.resetPage(); |
|||
} else { |
|||
this.$alert(data.msg || '入库并运输失败', '错误'); |
|||
} |
|||
}).catch(error => { |
|||
console.error('入库并运输失败:', error); |
|||
this.$message.error(error.message || '入库并运输失败'); |
|||
}).finally(() => { |
|||
this.transportLoading = false; |
|||
}); |
|||
}).catch(() => { |
|||
// 用户取消操作 |
|||
}); |
|||
}, |
|||
|
|||
// 重置页面 - rqrq |
|||
resetPage() { |
|||
this.palletCode = ''; |
|||
this.palletScanned = false; |
|||
this.palletInfo = { |
|||
currentStationId: '', |
|||
currentStationCode: '', |
|||
palletType: '' |
|||
}; |
|||
this.currentPalletType = ''; |
|||
this.palletTypeOptions = []; |
|||
|
|||
this.$nextTick(() => { |
|||
if (this.$refs.palletInput) { |
|||
this.$refs.palletInput.focus(); |
|||
} |
|||
}); |
|||
} |
|||
}, |
|||
mounted() { |
|||
this.$nextTick(() => { |
|||
if (this.$refs.palletInput) { |
|||
this.$refs.palletInput.focus(); |
|||
} |
|||
}); |
|||
} |
|||
}; |
|||
</script> |
|||
|
|||
<style scoped> |
|||
/* 托盘信息区域 - rqrq */ |
|||
.pallet-info-section { |
|||
margin-top: 16px; |
|||
padding: 12px; |
|||
background: #f5f7fa; |
|||
border-radius: 6px; |
|||
} |
|||
|
|||
.info-row { |
|||
display: flex; |
|||
align-items: center; |
|||
padding: 8px 0; |
|||
border-bottom: 1px solid #e4e7ed; |
|||
} |
|||
|
|||
.info-row:last-child { |
|||
border-bottom: none; |
|||
} |
|||
|
|||
.info-label { |
|||
font-weight: bold; |
|||
color: #606266; |
|||
width: 120px; |
|||
flex-shrink: 0; |
|||
} |
|||
|
|||
.info-value { |
|||
color: #303133; |
|||
font-size: 14px; |
|||
} |
|||
|
|||
.button-row { |
|||
margin-top: 12px; |
|||
} |
|||
</style> |
|||
|
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue