diff --git a/src/api/automatedWarehouse/palletPacking.js b/src/api/automatedWarehouse/palletPacking.js index 72336b2..c9b1465 100644 --- a/src/api/automatedWarehouse/palletPacking.js +++ b/src/api/automatedWarehouse/palletPacking.js @@ -75,3 +75,6 @@ export const completePalletAssemblyForFenJian = data => createAPI(`/wcsIntegrati // 调用空托盘到指定站点(选择区域、站点、栈板类型)- rqrq export const callEmptyPalletToStation = data => createAPI(`/wcsIntegration/callEmptyPalletToStation`,'post',data) + +// 结束分拣(下达预约送货任务到Z104区域,并更新pallet_detail的wcs_flag为1)- rqrq +export const finishSorting = data => createAPI(`/wcsIntegration/finishSorting`,'post',data) diff --git a/src/views/modules/automatedWarehouse/palletSorting.vue b/src/views/modules/automatedWarehouse/palletSorting.vue index 6bf09f5..204ace0 100644 --- a/src/views/modules/automatedWarehouse/palletSorting.vue +++ b/src/views/modules/automatedWarehouse/palletSorting.vue @@ -30,6 +30,9 @@ spellcheck="false" ref="palletInput" /> + @@ -432,7 +435,8 @@ import { getAvailableAgvStations, callPalletToStation, completePalletAssemblyForFenJian, - getAvailablePositionsForLayer + getAvailablePositionsForLayer, + finishSorting } from '../../../api/automatedWarehouse/palletPacking' export default { @@ -502,6 +506,7 @@ export default { editPositionLoading: false, // 修改位置按钮 callPalletLoading: false, // Call栈板按钮 completeAssemblyLoading: false, // 完成组托按钮 + finishSortingLoading: false, // 结束分拣按钮 - rqrq }; }, methods: { @@ -1447,6 +1452,56 @@ export default { showDetailModal(){ this.detailModalVisible=true; }, + + // 结束分拣按钮点击事件 - rqrq + handleFinishSorting() { + if (!this.palletCode) { + this.$message.error('请先扫描栈板'); + return; + } + + // 检查是否有栈板明细 + // if (!this.detailList || this.detailList.length === 0) { + // this.$message.error('栈板明细为空,无法结束分拣'); + // return; + // } + + // 确认操作 - rqrq + this.$confirm('确认结束分拣并将栈板送至缓存区(Z104)吗?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + this.doFinishSorting(); + }).catch(() => { + // 用户取消 + }); + }, + + // 执行结束分拣 - rqrq + doFinishSorting() { + // 设置loading状态,防止重复点击 - rqrq + this.finishSortingLoading = true; + + finishSorting({ + site: this.site, + palletId: this.palletCode + }).then(({ data }) => { + if (data.code === 0) { + this.$message.success('结束分拣成功,已创建送货任务'); + // 清空页面数据,初始化页面 - rqrq + this.resetPage(); + } else { + this.$message.error(data.msg || '结束分拣失败'); + } + }).catch(error => { + console.error('结束分拣失败:', error); + this.$message.error('结束分拣失败'); + }).finally(() => { + // 无论成功或失败,都要恢复按钮状态 - rqrq + this.finishSortingLoading = false; + }); + }, }, mounted() { this.$nextTick(() => {