fix:退料页面优化,对账修改关闭逐个查询
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -52,9 +52,6 @@
|
||||
<if test="query.sourceHouseCode != null and query.sourceHouseCode != ''">
|
||||
and source_house_code like concat('%', #{query.sourceHouseCode}, '%')
|
||||
</if>
|
||||
<if test="query.sourceHouseCode != null and query.sourceHouseCode != ''">
|
||||
and target_house_code like concat('%', #{query.targetHouseCode}, '%')
|
||||
</if>
|
||||
<if test="query.status != null">
|
||||
and status = #{query.status}
|
||||
</if>
|
||||
|
||||
@@ -150,19 +150,46 @@
|
||||
<el-button type="primary" @click="doPrint">打印</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
<el-dialog :visible.sync="inventoryLoading" title="仓库分配" width="820px" :close-on-click-modal="false" @close="closeAllocateDialog">
|
||||
<div style="margin-bottom:10px;color:#606266;font-size:13px;">
|
||||
物料编码:<strong>{{ currentReturn.sku_code }}</strong> |
|
||||
<el-dialog
|
||||
:visible.sync="allocateVisible"
|
||||
title="仓库分配"
|
||||
width="520px"
|
||||
:close-on-click-modal="false"
|
||||
@close="closeAllocateDialog"
|
||||
>
|
||||
<div style="margin-bottom:12px;color:#606266;font-size:13px;">
|
||||
物料编码:<strong>{{ currentReturn.skuCode }}</strong> |
|
||||
物料名称:<strong>{{ currentReturn.skuName }}</strong> |
|
||||
需求数量:<strong style="color:#E6A23C;">{{ currentReturn.qty }} {{ currentReturn.unit }}</strong>
|
||||
</div>
|
||||
<el-table ref="allocateTable" :data="inventoryList" size="small" border @selection-change="handleInventorySelection">
|
||||
<el-table-column type="selection" width="45" />
|
||||
<el-table-column prop="label" label="仓库名称" min-width="130" show-overflow-tooltip />
|
||||
<el-table-column prop="value" label="仓库编码" min-width="130" show-overflow-tooltip />
|
||||
</el-table>
|
||||
<el-form size="mini" label-width="90px" label-suffix=":" @submit.native.prevent>
|
||||
<el-form-item label="目标仓库" required>
|
||||
<el-select
|
||||
v-model="selectedHouseCode"
|
||||
filterable
|
||||
clearable
|
||||
:loading="storLoading"
|
||||
placeholder="请选择仓库,可输入编码或名称搜索"
|
||||
style="width: 100%;"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in storList"
|
||||
:key="item.stor_code"
|
||||
:label="item.stor_code + ' ' + item.stor_name"
|
||||
:value="item.stor_code"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button size="mini" @click="closeAllocateDialog">取消</el-button>
|
||||
<el-button size="mini" type="primary" :loading="!allocateSaving" @click="saveAllocate">保存分配</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="primary"
|
||||
:loading="allocateSaving"
|
||||
:disabled="!selectedHouseCode"
|
||||
@click="saveAllocate"
|
||||
>保存分配</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user