diff --git a/src/api/automatedWarehouse/palletPacking.js b/src/api/automatedWarehouse/palletPacking.js index 6aeb563..c8e89fd 100644 --- a/src/api/automatedWarehouse/palletPacking.js +++ b/src/api/automatedWarehouse/palletPacking.js @@ -38,3 +38,6 @@ export const createPalletTransportTask = data => createAPI(`/wcsIntegration/crea // Call栈板到指定站点 - AI制作 export const callPalletToStation = data => createAPI(`/wcsIntegration/callPalletToStation`,'post',data) + +// Call栈板到指定站点(包含组盘处理) - AI制作 +export const callPalletToStationWithUpdateZuPan = data => createAPI(`/wcsIntegration/callPalletToStationWithUpdateZuPan`,'post',data) diff --git a/src/views/modules/automatedWarehouse/palletPacking.vue b/src/views/modules/automatedWarehouse/palletPacking.vue index 8c2669d..68f09a1 100644 --- a/src/views/modules/automatedWarehouse/palletPacking.vue +++ b/src/views/modules/automatedWarehouse/palletPacking.vue @@ -288,22 +288,15 @@ /> - +
- - - +
@@ -311,15 +304,14 @@ @@ -343,11 +335,28 @@ :append-to-body="true" >
+ +
+ + + + +
+
@@ -381,9 +390,8 @@ import { getLayersForEdit, updatePalletDetailPosition, getAgvStations, - getTargetStations, - createPalletTransportTask, - callPalletToStation + callPalletToStation, + callPalletToStationWithUpdateZuPan } from '../../../api/automatedWarehouse/palletPacking' export default { @@ -413,15 +421,15 @@ export default { // 运输任务模态框 transportModalVisible: false, - startStationOptions: [], - targetStationOptions: [], - selectedStartStation: '', + transportStationOptions: [], + currentPalletStation: '', selectedTargetStation: '', // Call栈板模态框 callPalletModalVisible: false, callStationOptions: [], - selectedCallStation: '', + selectedCallStartStation: '', + selectedCallTargetStation: '', // 修改位置模态框 editPositionModalVisible: false, @@ -452,7 +460,6 @@ export default { if (data.code === 0) { this.palletScanned = true; this.positionOptions = data.positions || []; - this.$message.success('栈板验证成功'); this.refreshTable(); } else { this.$message.error(data.msg || '栈板不存在'); @@ -466,7 +473,8 @@ export default { // Call栈板 - 调用空托盘 handleCallPallet() { this.callPalletModalVisible = true; - this.selectedCallStation = ''; + this.selectedCallStartStation = ''; + this.selectedCallTargetStation = ''; // 获取AGV站点列表 getAgvStations({}).then(({ data }) => { @@ -725,49 +733,47 @@ export default { return; } - this.transportModalVisible = true; - this.selectedStartStation = ''; - this.selectedTargetStation = ''; - this.targetStationOptions = []; - - // 获取AGV站点列表 - getAgvStations({}).then(({ data }) => { - if (data.code === 0) { - this.startStationOptions = data.stations || []; - } else { - this.$message.error(data.msg || '获取站点列表失败'); - } - }).catch(error => { - console.error('获取站点列表失败:', error); - this.$message.error('获取站点列表失败'); - }); - }, - - // 起点站点选择变化 - handleStartStationChange() { - this.selectedTargetStation = ''; - this.targetStationOptions = []; - - if (this.selectedStartStation) { - getTargetStations({ - startStation: this.selectedStartStation - }).then(({ data }) => { - if (data.code === 0) { - this.targetStationOptions = data.targets || []; - } else { - this.$message.error(data.msg || '获取目标站点失败'); - } - }).catch(error => { - console.error('获取目标站点失败:', error); - this.$message.error('获取目标站点失败'); - }); - } + // 首先获取当前栈板信息 + checkPalletExists({ + site: this.site, + palletId: this.palletCode + }).then(({ data }) => { + if (data.code == 0) { + // 从返回数据中获取栈板位置信息 + this.currentPalletStation = data.locationCode || ''; + if (!this.currentPalletStation) { + this.$message.error('无法获取当前栈板位置'); + return; + } + + this.transportModalVisible = true; + this.selectedTargetStation = ''; + this.transportStationOptions = []; + + // 获取所有AGV站点列表(和Call栈板一样的逻辑) + getAgvStations({}).then(({ data }) => { + if (data.code === 0) { + this.transportStationOptions = data.stations || []; + } else { + this.$message.error(data.msg || '获取站点列表失败'); + } + }).catch(error => { + console.error('获取站点列表失败:', error); + this.$message.error('获取站点列表失败'); + }); + } else { + this.$message.error(data.msg || '获取栈板信息失败'); + } + }).catch(error => { + console.error('获取栈板信息失败:', error); + this.$message.error('获取栈板信息失败'); + }); }, // 确认创建运输任务 confirmTransportTask() { - if (!this.selectedStartStation) { - this.$message.error('请选择起点站点'); + if (!this.currentPalletStation) { + this.$message.error('无法获取当前栈板位置'); return; } if (!this.selectedTargetStation) { @@ -775,15 +781,23 @@ export default { return; } - createPalletTransportTask({ + // 前端验证:起始站点和目标站点不能一样 + if (this.currentPalletStation === this.selectedTargetStation) { + this.$message.error('起始站点和目标站点不能相同'); + return; + } + + // 调用包含组盘处理的接口 + callPalletToStationWithUpdateZuPan({ site: this.site, - palletId: this.palletCode, - startStation: this.selectedStartStation, - endStation: this.selectedTargetStation + startStation: this.currentPalletStation, + targetStation: this.selectedTargetStation }).then(({ data }) => { if (data.code === 0) { - this.$message.success('运输任务创建成功'); + this.$message.success('栈板运输任务创建成功'); this.closeTransportModal(); + // 可能需要刷新栈板明细来反映组盘状态的变化 + this.refreshTable(); } else { this.$message.error(data.msg || '创建运输任务失败'); } @@ -796,22 +810,32 @@ export default { // 关闭运输任务模态框 closeTransportModal() { this.transportModalVisible = false; - this.selectedStartStation = ''; + this.currentPalletStation = ''; this.selectedTargetStation = ''; - this.startStationOptions = []; - this.targetStationOptions = []; + this.transportStationOptions = []; }, // 确认Call栈板 confirmCallPallet() { - if (!this.selectedCallStation) { - this.$message.error('请选择站点'); + if (!this.selectedCallStartStation) { + this.$message.error('请选择起始站点'); + return; + } + if (!this.selectedCallTargetStation) { + this.$message.error('请选择目标站点'); + return; + } + + // 前端验证:两个站点不能一样 + if (this.selectedCallStartStation === this.selectedCallTargetStation) { + this.$message.error('起始站点和目标站点不能相同'); return; } callPalletToStation({ site: this.site, - station: this.selectedCallStation + startStation: this.selectedCallStartStation, + targetStation: this.selectedCallTargetStation }).then(({ data }) => { if (data.code === 0) { this.$message.success('空托盘调用任务创建成功'); @@ -828,7 +852,8 @@ export default { // 关闭Call栈板模态框 closeCallPalletModal() { this.callPalletModalVisible = false; - this.selectedCallStation = ''; + this.selectedCallStartStation = ''; + this.selectedCallTargetStation = ''; this.callStationOptions = []; },