diff --git a/RuoYi-App-master/pages/in/bindMsg.vue b/RuoYi-App-master/pages/in/bindMsg.vue index d4aa4b3..dc504d9 100644 --- a/RuoYi-App-master/pages/in/bindMsg.vue +++ b/RuoYi-App-master/pages/in/bindMsg.vue @@ -126,6 +126,29 @@ + + + + + 选择入口 + + + 入口 + + + {{ selectedEntrance }} + 请选择入口 + ▼ + + + + + + + + + + @@ -146,6 +169,11 @@ cargoSpaceName: '', cargoSpaceList: [], cargoSpaceHeight: null, + // 入口选择相关 + entranceList: [], + selectedEntrance: '', + selectedEntranceId: '', + selectedEntranceIndex: 0, } }, @@ -159,6 +187,25 @@ }, methods: { + // 根据仓库ID获取入口列表 + getEntranceListByWarehouseId(warehouseId) { + this.entranceList = [] + this.selectedEntrance = '' + this.selectedEntranceId = '' + this.selectedEntranceIndex = 0 + + if (warehouseId === '02') { + this.entranceList = [ + { id: 'G1001', name: 'G1001' }, + { id: 'G1007', name: 'G1007' } + ] + } else if (warehouseId === '13') { + this.entranceList = [ + { id: 'G3006', name: 'G3006' }, + { id: 'G1001', name: 'G1001' } + ] + } + }, // 处理货位选择 async handleRecommendCargoSpace() { @@ -310,40 +357,20 @@ } const warehouseType = this.materialList[0].warehouseType + const warehouseId = this.materialList[0].warehouseId if (warehouseType === '1') { // 显示货位选择弹出框 this.$refs.cargoSpacePopup.open() } else { - // 非货位类型仓库,直接调用入库接口 - try { - const response = await addInJob({ - trayCode: this.trayCode, - warehouseId: this.materialList[0].warehouseId - }) - - if (response.code === 200) { - uni.showToast({ - title: this.$t('inbound.bindMsg.inboundSuccess'), - icon: 'success' - }) - // 清空数据 - this.trayCode = '' - this.materialList = [] - this.stockinDetailId='' - // this.cargoSpaceId = '' - } else { - uni.showToast({ - title: response.msg || this.$t('inbound.bindMsg.inboundFailed'), - icon: 'none' - }) - } - } catch (error) { - uni.showToast({ - title: this.$t('inbound.bindMsg.inboundFailed'), - icon: 'none' - }) + // 非货位类型仓库,显示入口选择弹出框 + this.getEntranceListByWarehouseId(warehouseId) + if (this.entranceList.length > 0) { + this.$refs.entrancePopup.open() + } else { + // 如果没有配置入口,直接调用入库接口 + this.submitWithoutCargoSpace() } } }, @@ -366,6 +393,98 @@ this.cargoSpaceName = '' this.cargoSpaceHeight='' }, + // 处理入口选择变化 + handleEntranceChange(e) { + const index = e.detail.value + this.selectedEntranceIndex = index + if (this.entranceList[index]) { + this.selectedEntrance = this.entranceList[index].name + this.selectedEntranceId = this.entranceList[index].id + } + }, + // 处理确认入口选择 + async handleConfirmEntrance() { + if (!this.selectedEntranceId) { + uni.showToast({ + title: '请选择入口', + icon: 'none' + }) + return + } + this.$refs.entrancePopup.close() + this.submitWithEntrance() + }, + // 处理取消入口选择 + handleCancelEntrance() { + this.$refs.entrancePopup.close() + this.selectedEntrance = '' + this.selectedEntranceId = '' + this.selectedEntranceIndex = 0 + }, + // 不带货位信息提交入库 + async submitWithoutCargoSpace() { + try { + const response = await addInJob({ + trayCode: this.trayCode, + warehouseId: this.materialList[0].warehouseId + }) + + if (response.code === 200) { + uni.showToast({ + title: this.$t('inbound.bindMsg.inboundSuccess'), + icon: 'success' + }) + // 清空数据 + this.trayCode = '' + this.materialList = [] + this.stockinDetailId = '' + } else { + uni.showToast({ + title: response.msg || this.$t('inbound.bindMsg.inboundFailed'), + icon: 'none' + }) + } + } catch (error) { + uni.showToast({ + title: this.$t('inbound.bindMsg.inboundFailed'), + icon: 'none' + }) + } + }, + // 带入口信息提交入库 + async submitWithEntrance() { + try { + const response = await addInJob({ + trayCode: this.trayCode, + warehouseId: this.materialList[0].warehouseId, + entranceId: this.selectedEntranceId + }) + + if (response.code === 200) { + uni.showToast({ + title: this.$t('inbound.bindMsg.inboundSuccess'), + icon: 'success' + }) + // 清空数据 + this.trayCode = '' + this.materialList = [] + this.stockinDetailId = '' + this.selectedEntrance = '' + this.selectedEntranceId = '' + this.selectedEntranceIndex = 0 + } else { + uni.showToast({ + title: response.msg || this.$t('inbound.bindMsg.inboundFailed'), + icon: 'none' + }) + } + } catch (error) { + uni.showToast({ + title: this.$t('inbound.bindMsg.inboundFailed'), + icon: 'none' + }) + } + }, // 处理子单据输入事件 async handleSubOrderInput(value) { if (value) { @@ -724,4 +843,25 @@ color: #999; font-size: 28rpx; } + + .picker-input { + display: flex; + align-items: center; + justify-content: space-between; + padding: 20rpx; + border: 1px solid #ddd; + border-radius: 6rpx; + background-color: #fff; + min-height: 60rpx; + } + + .placeholder-text { + color: #999; + font-size: 28rpx; + } + + .picker-arrow { + color: #666; + font-size: 24rpx; + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaServiceImp.java b/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaServiceImp.java index 4af1488..edbbcb5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaServiceImp.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pda/service/PdaServiceImp.java @@ -229,7 +229,7 @@ public class PdaServiceImp implements PdaService { public AjaxResult addInJob(TrayCodeMsg trayCodeMsg) { HashMap map = new HashMap<>(); map.put("v_tray_code", trayCodeMsg.getTrayCode()); -// map.put("v_warehouse_id", trayCodeMsg.getWarehouseId()); + map.put("v_entrance_id", trayCodeMsg.getEntranceId()); map.put("v_cargo_space_id", trayCodeMsg.getCargoSpaceId()); pdaMapper.addInJob(map); String result = map.get("v_result").toString(); diff --git a/ruoyi-admin/src/main/resources/mapper/pda/PdaMapper.xml b/ruoyi-admin/src/main/resources/mapper/pda/PdaMapper.xml index 6b275bc..a8532ef 100644 --- a/ruoyi-admin/src/main/resources/mapper/pda/PdaMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/pda/PdaMapper.xml @@ -63,6 +63,7 @@