From 616f1ee81b44705ef706c67f9da99e74f61d3d2b Mon Sep 17 00:00:00 2001 From: zhaoyf <1783123481@qq.com> Date: Mon, 30 Nov 2026 15:20:19 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E9=80=80=E6=96=99=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BC=98=E5=8C=96=EF=BC=8C=E5=AF=B9=E8=B4=A6=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=85=B3=E9=97=AD=E9=80=90=E4=B8=AA=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sap/service/SapStockQueryService.java | 7 +- .../service/dao/mapper/xml/PmReturnMapper.xml | 3 - .../views/wms/pm_manage/pmReturn/index.vue | 142 +++++++++++------- 3 files changed, 92 insertions(+), 60 deletions(-) diff --git a/nladmin-system/wms-server/src/main/java/org/nl/wms/ext_manage/sap/service/SapStockQueryService.java b/nladmin-system/wms-server/src/main/java/org/nl/wms/ext_manage/sap/service/SapStockQueryService.java index 6c2e9466..e5323b49 100644 --- a/nladmin-system/wms-server/src/main/java/org/nl/wms/ext_manage/sap/service/SapStockQueryService.java +++ b/nladmin-system/wms-server/src/main/java/org/nl/wms/ext_manage/sap/service/SapStockQueryService.java @@ -32,7 +32,7 @@ import java.util.stream.Collectors; public class SapStockQueryService { /** 单次请求的最大物料数,避免报文过大 */ - private static final int BATCH_SIZE = 200; + private static final int BATCH_SIZE = 10000; private final SapApi sapApi; @@ -77,8 +77,9 @@ public class SapStockQueryService { JSONObject result = sapApi.stockQueryBatch(chunk, SapConstant.WERKS, targetLgort); mergeInto(merged, parse(result)); } catch (Exception e) { - log.warn("SAP库存批量查询失败({}个物料),退回逐个查询:{}", chunk.size(), e.getMessage()); - queryOneByOne(merged, chunk, targetLgort, failedMaterials); + throw new BadRequestException("SAP库存查询失败:" + e.getMessage()); +// log.warn("SAP库存批量查询失败({}个物料),退回逐个查询:{}", chunk.size(), e.getMessage()); +// queryOneByOne(merged, chunk, targetLgort, failedMaterials); } } return merged; diff --git a/nladmin-system/wms-server/src/main/java/org/nl/wms/pm_manage/pmreturn/service/dao/mapper/xml/PmReturnMapper.xml b/nladmin-system/wms-server/src/main/java/org/nl/wms/pm_manage/pmreturn/service/dao/mapper/xml/PmReturnMapper.xml index 1df60b67..00fb06b9 100644 --- a/nladmin-system/wms-server/src/main/java/org/nl/wms/pm_manage/pmreturn/service/dao/mapper/xml/PmReturnMapper.xml +++ b/nladmin-system/wms-server/src/main/java/org/nl/wms/pm_manage/pmreturn/service/dao/mapper/xml/PmReturnMapper.xml @@ -52,9 +52,6 @@ and source_house_code like concat('%', #{query.sourceHouseCode}, '%') - - and target_house_code like concat('%', #{query.targetHouseCode}, '%') - and status = #{query.status} diff --git a/nladmin-ui/src/views/wms/pm_manage/pmReturn/index.vue b/nladmin-ui/src/views/wms/pm_manage/pmReturn/index.vue index 42eec5b0..57825c22 100644 --- a/nladmin-ui/src/views/wms/pm_manage/pmReturn/index.vue +++ b/nladmin-ui/src/views/wms/pm_manage/pmReturn/index.vue @@ -150,19 +150,46 @@ 打印 - -
- 物料编码:{{ currentReturn.sku_code }}  |  + +
+ 物料编码:{{ currentReturn.skuCode }}  |  + 物料名称:{{ currentReturn.skuName }}  |  需求数量:{{ currentReturn.qty }} {{ currentReturn.unit }}
- - - - - + + + + + + +
@@ -178,6 +205,7 @@ import udOperation from '@crud/UD.operation.vue' import pagination from '@crud/Pagination.vue' import QRCode from 'qrcode' import { allocate, upload } from '@/views/wms/pm_manage/pmReturn/pmReturn' +import { getStor } from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr' const createDefaultForm = () => ({ id: '', @@ -217,12 +245,14 @@ export default { data() { return { viewShow: false, - inventoryLoading: false, + allocateVisible: false, + allocateSaving: false, + storList: [], + storLoading: false, + selectedHouseCode: '', currentRow: {}, currentReturn: {}, multipleSelection: [], - selectedInventory: '', - allocateSaving: false, actionDisabled: true, printPreviewVisible: false, permission: { @@ -237,13 +267,6 @@ export default { { value: 20, label: '执行' }, { value: 80, label: '完成' } ], - inventoryList: [ - { value: 'R001', label: '中鼎立库' }, - { value: 'R002', label: '装配车间平库' }, - { value: 'R003', label: '装配车间大件库' }, - { value: 'R005', label: '库改车原材料库' }, - { value: 'H005', label: '结构件仓库' }, - ], deliveryMethodOptions: [ { value: 1, label: '人工' }, { value: 2, label: 'AGV' } @@ -266,6 +289,9 @@ export default { } } }, + created() { + this.loadStorList() + }, methods: { [CRUD.HOOK.beforeRefresh]() { if (this.query.dateRange) { @@ -325,45 +351,53 @@ export default { this.currentRow = { ...row } this.viewShow = true }, - openAllocateDialog(row) { - this.inventoryLoading = true - this.currentReturn = row - this.allocateSaving = false - }, - closeAllocateDialog() { - this.inventoryLoading = false - this.currentReturn = {} - this.selectedInventory = '' - this.allocateSaving = false - }, - handleInventorySelection(selection) { - // 如果选中了多个,只保留最后一个 - if (selection.length > 1) { - this.selectedInventory = '' - this.allocateSaving = false - } else if (selection.length === 1) { - this.selectedInventory = selection[0].value - this.allocateSaving = true - } else { - this.selectedInventory = '' - this.allocateSaving = false - } - }, - saveAllocate() { - if (!this.selectedInventory) { - this.$message.warning('请至少勾选一条库存记录') + loadStorList() { + if (this.storList.length || this.storLoading) { return } - this.currentReturn.targetHouseCode = this.selectedInventory - allocate(this.currentReturn).then(res => { - if (res.code == 400) { - this.$message.warning('分配失败' + res.message) + this.storLoading = true + getStor().then(res => { + this.storList = (res && res.data) || [] + }).catch(() => { + this.storList = [] + }).finally(() => { + this.storLoading = false + }) + }, + openAllocateDialog(row) { + this.currentReturn = { ...row } + // 已分配过的单据回显当前目标仓库,方便只做修改 + this.selectedHouseCode = row.targetHouseCode || '' + this.allocateVisible = true + this.loadStorList() + }, + closeAllocateDialog() { + this.allocateVisible = false + this.currentReturn = {} + this.selectedHouseCode = '' + this.allocateSaving = false + }, + saveAllocate() { + if (!this.selectedHouseCode) { + this.$message.warning('请选择目标仓库') + return + } + if (this.allocateSaving) { + return + } + this.allocateSaving = true + allocate({ ...this.currentReturn, targetHouseCode: this.selectedHouseCode }).then(res => { + if (res && res.code === 400) { + this.$message.warning('分配失败:' + res.message) return } this.$message.success('分配成功') - this.crud.toQuery() - }).finally(() => { this.closeAllocateDialog() + this.crud.toQuery() + }).catch(() => { + // 失败提示已由请求拦截器统一处理,保留弹窗便于重新选择仓库 + }).finally(() => { + this.allocateSaving = false }) }, handleBatchPush() { @@ -382,7 +416,7 @@ export default { type: 'warning' }).then(() => { upload(this.multipleSelection[0]).then(res => { - if (res.code == 400) { + if (res && res.code === 400) { this.$message.warning('分配失败' + res.message) return } @@ -409,7 +443,7 @@ export default { type: 'warning' }).then(() => { upload(this.multipleSelection[0]).then(res => { - if (res.code == 400) { + if (res && res.code === 400) { this.$message.warning('分配失败' + res.message) return }