fix:库存对账按仓库查询,sap强制校验

This commit is contained in:
zhaoyf
2026-11-09 21:39:43 +08:00
parent 0b95723e91
commit 22a8bdd4bb
12 changed files with 146 additions and 81 deletions

View File

@@ -8,22 +8,22 @@
label-width="90px"
label-suffix=":"
>
<el-form-item label="所属库区">
<el-form-item label="所属仓库">
<el-select
v-model="sectCode"
v-model="storCode"
clearable
filterable
size="small"
placeholder="请选择库区"
placeholder="请选择仓库"
class="filter-item"
style="width: 280px;"
@change="onSectChange"
@change="onStorChange"
>
<el-option
v-for="item in sects"
:key="item.value"
:label="item.label"
:value="item.value"
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>
@@ -32,7 +32,7 @@
v-model="materialCode"
clearable
size="small"
placeholder="物料编号(不填则按库区库存逐个查SAP)"
placeholder="物料编号(不填则按仓库库存逐个查SAP)"
style="width: 200px;"
class="filter-item"
@keyup.enter.native="queryReconcile"
@@ -122,7 +122,7 @@
</template>
<script>
import crudSectattr from '@/views/wms/basedata/sectattr/sectattr'
import { getStor } from '@/views/wms/basedata/bsrealstorattr/bsrealstorattr'
import { reconcile } from './bi'
import request from '@/utils/request'
import { download } from '@/api/data'
@@ -133,8 +133,7 @@ export default {
data() {
return {
storCode: '',
sects: [],
sectCode: '',
storList: [],
materialCode: '',
onlyDiff: false,
loading: false,
@@ -174,22 +173,15 @@ export default {
}
},
created() {
crudSectattr.getSectCode({ 'stor_code': this.storCode }).then(res => {
const options = []
;(res.data || []).forEach(stor => {
(stor.children || []).forEach(sect => {
options.push({
value: sect.value,
label: stor.label + ' / ' + sect.label
})
})
})
this.sects = options
getStor().then(res => {
this.storList = res.data || []
}).catch(() => {
this.storList = []
})
},
methods: {
onSectChange() {
if (!this.sectCode) {
onStorChange() {
if (!this.storCode) {
this.tableData = []
this.queried = false
return
@@ -202,13 +194,13 @@ export default {
}
},
queryReconcile() {
if (!this.sectCode) {
this.$message.warning('请选择库区')
if (!this.storCode) {
this.$message.warning('请选择仓库')
return
}
const materialCode = (this.materialCode || '').trim()
this.loading = true
reconcile({ sectCode: this.sectCode, materialCode }).then(res => {
reconcile({ storCode: this.storCode, materialCode }).then(res => {
const data = res.data || {}
this.compareSourceName = data.compareSourceName || '对比库存'
this.failedMaterials = data.failedMaterials || []
@@ -228,15 +220,15 @@ export default {
})
},
exportExcel() {
if (!this.sectCode) {
this.$message.warning('请选择库区')
if (!this.storCode) {
this.$message.warning('请选择仓库')
return
}
if (this.downloadLoading) {
return
}
this.downloadLoading = true
download('/api/bi/reconcile/download', { sectCode: this.sectCode, materialCode: (this.materialCode || '').trim(), onlyDiff: this.onlyDiff }).then(result => {
download('/api/bi/reconcile/download', { storCode: this.storCode, materialCode: (this.materialCode || '').trim(), onlyDiff: this.onlyDiff }).then(result => {
downloadFile(result, '库存对账', 'xlsx')
}).catch(() => {
this.$message.error('导出失败')
@@ -273,7 +265,7 @@ export default {
method: 'get',
params: {
material_code: this.flowMaterialCode,
sect_code: this.sectCode,
stor_code: this.storCode,
page: this.flowPage.page - 1,
size: this.flowPage.size
}