|
|
@@ -234,6 +234,14 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
+ <template v-slot:availableCountBase="{ row }">
|
|
|
+ <span>{{
|
|
|
+ row.availableCountBase === undefined ||
|
|
|
+ row.availableCountBase === null
|
|
|
+ ? 0
|
|
|
+ : row.availableCountBase
|
|
|
+ }}</span>
|
|
|
+ </template>
|
|
|
|
|
|
<template v-slot:singlePrice="scope">
|
|
|
<el-form-item
|
|
|
@@ -346,11 +354,6 @@
|
|
|
</el-input>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
- <template v-slot:warehouseNum="scope">
|
|
|
- <el-form-item :prop="'datasource.' + scope.$index + '.warehouseNum'">
|
|
|
- <span>{{ scope.row.warehouseNum }}</span>
|
|
|
- </el-form-item>
|
|
|
- </template>
|
|
|
<template v-slot:cuttingLength="{ row, $index }">
|
|
|
<el-form-item :prop="'datasource.' + $index + '.cuttingLength'">
|
|
|
<el-input v-model="row.cuttingLength" placeholder="请输入">
|
|
|
@@ -469,7 +472,7 @@
|
|
|
import dictMixins from '@/mixins/dictMixins';
|
|
|
import productListNew from './product-listNew.vue';
|
|
|
import {
|
|
|
- getWarehouseOutStock,
|
|
|
+ getWarehouseOutStockInfo,
|
|
|
getIdWarehouseList
|
|
|
} from '@/api/saleManage/saleorder';
|
|
|
|
|
|
@@ -543,7 +546,7 @@
|
|
|
// warehouseName:'',
|
|
|
};
|
|
|
return {
|
|
|
- cacheKeyUrl: 'eos-saleManage-invoice-inventoryTable-202605131602',
|
|
|
+ cacheKeyUrl: 'eos-saleManage-invoice-inventoryTable-2026082501',
|
|
|
current: {},
|
|
|
childrenColumns: [
|
|
|
{
|
|
|
@@ -768,10 +771,16 @@
|
|
|
},
|
|
|
{
|
|
|
width: 100,
|
|
|
- prop: 'warehouseNum',
|
|
|
- label: '库存',
|
|
|
- align: 'center',
|
|
|
- slot: 'warehouseNum'
|
|
|
+ prop: 'stockCountBase',
|
|
|
+ label: '库存数量',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ width: 100,
|
|
|
+ prop: 'availableCountBase',
|
|
|
+ label: '可用数量',
|
|
|
+ slot: 'availableCountBase',
|
|
|
+ align: 'center'
|
|
|
},
|
|
|
|
|
|
// {
|
|
|
@@ -1109,6 +1118,44 @@
|
|
|
this.selection = [];
|
|
|
},
|
|
|
|
|
|
+ // 将接口返回的库存数量和可用数量同步到当前物品清单行。
|
|
|
+ setWarehouseOutStock(index, stockInfo) {
|
|
|
+ const stockCountBase = stockInfo?.stockCountBase || 0;
|
|
|
+ const availableCountBase = stockInfo?.availableCountBase || 0;
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'stockCountBase',
|
|
|
+ stockCountBase
|
|
|
+ );
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'availableCountBase',
|
|
|
+ availableCountBase
|
|
|
+ );
|
|
|
+ // 保留原字段,兼容已有发货数量校验和提交逻辑。
|
|
|
+ this.$set(
|
|
|
+ this.form.datasource[index],
|
|
|
+ 'warehouseNum',
|
|
|
+ availableCountBase
|
|
|
+ );
|
|
|
+ },
|
|
|
+
|
|
|
+ async refreshWarehouseOutStock(index, row) {
|
|
|
+ if (!row.warehouseId) {
|
|
|
+ this.setWarehouseOutStock(index, {});
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const stockInfo = await getWarehouseOutStockInfo({
|
|
|
+ warehouseId: row.warehouseId,
|
|
|
+ code: row.productCode,
|
|
|
+ batchNo: row.batchNo,
|
|
|
+ systemBatchNo: row.systemBatchNo,
|
|
|
+ colorKey: row.colorKey,
|
|
|
+ modelType: row.modelType
|
|
|
+ });
|
|
|
+ this.setWarehouseOutStock(index, stockInfo);
|
|
|
+ },
|
|
|
+
|
|
|
async warehouseChange(index, row, isReset = false) {
|
|
|
console.log('warehouseChange', index, row.warehouseId, isReset);
|
|
|
const data = row.warehouseList.find(
|
|
|
@@ -1128,20 +1175,6 @@
|
|
|
data?.warehouseCode || 0
|
|
|
);
|
|
|
|
|
|
- const warehouseOutStock = await getWarehouseOutStock({
|
|
|
- warehouseId: data?.warehouseId || '',
|
|
|
- code: row.productCode,
|
|
|
- batchNo: row.batchNo,
|
|
|
- systemBatchNo: row.systemBatchNo,
|
|
|
- colorKey: row.colorKey,
|
|
|
- modelType: row.modelType
|
|
|
- });
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'warehouseNum',
|
|
|
- warehouseOutStock || 0
|
|
|
- );
|
|
|
-
|
|
|
const tempBatchNoList = await getBatchList({
|
|
|
warehouseId: data?.warehouseId || '',
|
|
|
categoryCode: row.productCode,
|
|
|
@@ -1159,11 +1192,13 @@
|
|
|
this.$set(this.form.datasource[index], 'batchNo', '');
|
|
|
this.$set(this.form.datasource[index], 'systemBatchNo', '');
|
|
|
}
|
|
|
+ await this.refreshWarehouseOutStock(index, this.form.datasource[index]);
|
|
|
},
|
|
|
|
|
|
//批次号选择
|
|
|
async batchNoChange(index, row) {
|
|
|
if (!row.batchStockId) {
|
|
|
+ this.$set(this.form.datasource[index], 'batchStockId', '');
|
|
|
this.$set(this.form.datasource[index], 'batchNo', '');
|
|
|
this.$set(this.form.datasource[index], 'systemBatchNo', '');
|
|
|
// this.$set(this.form.datasource[index], 'warehouseNum', '');
|
|
|
@@ -1180,19 +1215,9 @@
|
|
|
);
|
|
|
}
|
|
|
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'warehouseNum',
|
|
|
- row.warehouseId
|
|
|
- ? await getWarehouseOutStock({
|
|
|
- warehouseId: row.warehouseId,
|
|
|
- code: row.productCode,
|
|
|
- batchNo: row.batchNo,
|
|
|
- systemBatchNo: row.systemBatchNo,
|
|
|
- colorKey: row.colorKey,
|
|
|
- modelType: row.modelType
|
|
|
- })
|
|
|
- : ''
|
|
|
+ await this.refreshWarehouseOutStock(
|
|
|
+ index,
|
|
|
+ this.form.datasource[index]
|
|
|
);
|
|
|
|
|
|
return;
|
|
|
@@ -1201,13 +1226,13 @@
|
|
|
(item) => item.id == row.batchStockId
|
|
|
);
|
|
|
this.$set(this.form.datasource[index], 'batchNo', data.batchNo);
|
|
|
- this.$set(this.form.datasource[index], 'systemBatchNo', data.systemBatchNo);
|
|
|
-
|
|
|
this.$set(
|
|
|
this.form.datasource[index],
|
|
|
- 'warehouseNum',
|
|
|
- data.measureQuantity || 0
|
|
|
+ 'systemBatchNo',
|
|
|
+ data.systemBatchNo
|
|
|
);
|
|
|
+
|
|
|
+ await this.refreshWarehouseOutStock(index, this.form.datasource[index]);
|
|
|
},
|
|
|
//改变数量
|
|
|
changeCount(row, index, isBlockCount = true, weightType) {
|
|
|
@@ -1502,6 +1527,12 @@
|
|
|
let comitDatasource = this.form.datasource;
|
|
|
if (comitDatasource.length === 0) return [];
|
|
|
comitDatasource.forEach(async (v) => {
|
|
|
+ // 清空批次时同步清理批次库存 ID,避免更新接口残留旧批次。
|
|
|
+ if (!v.batchNo) {
|
|
|
+ v.batchNo = '';
|
|
|
+ v.systemBatchNo = '';
|
|
|
+ v.batchStockId = '';
|
|
|
+ }
|
|
|
if (v.modelKey) {
|
|
|
v.modelKey = v.modelKey;
|
|
|
}
|
|
|
@@ -1615,17 +1646,9 @@
|
|
|
})
|
|
|
);
|
|
|
if (item.warehouseId) {
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'warehouseNum',
|
|
|
- await getWarehouseOutStock({
|
|
|
- warehouseId: item.warehouseId,
|
|
|
- code: item.productCode,
|
|
|
- batchNo: item.batchNo,
|
|
|
- systemBatchNo: item.systemBatchNo,
|
|
|
- colorKey: item.colorKey,
|
|
|
- modelType: item.modelType
|
|
|
- })
|
|
|
+ await this.refreshWarehouseOutStock(
|
|
|
+ index,
|
|
|
+ this.form.datasource[index]
|
|
|
);
|
|
|
} else if (this.form.datasource[index]?.warehouseList?.length) {
|
|
|
this.$set(
|
|
|
@@ -1673,20 +1696,7 @@
|
|
|
'warehouseList',
|
|
|
tempWarehouse
|
|
|
);
|
|
|
- if (item.warehouseId) {
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'warehouseNum',
|
|
|
- await getWarehouseOutStock({
|
|
|
- warehouseId: item.warehouseId,
|
|
|
- code: item.productCode,
|
|
|
- batchNo: item.batchNo,
|
|
|
- systemBatchNo: item.systemBatchNo,
|
|
|
- colorKey: item.colorKey,
|
|
|
- modelType: item.modelType
|
|
|
- })
|
|
|
- );
|
|
|
- } else {
|
|
|
+ if (!item.warehouseId) {
|
|
|
if (this.form.datasource[index]?.warehouseList?.length) {
|
|
|
this.$set(
|
|
|
this.form.datasource[index],
|
|
|
@@ -1728,10 +1738,9 @@
|
|
|
'systemBatchNo',
|
|
|
batchNoObj.systemBatchNo || ''
|
|
|
);
|
|
|
- this.$set(
|
|
|
- this.form.datasource[index],
|
|
|
- 'warehouseNum',
|
|
|
- batchNoObj.measureQuantity || 0
|
|
|
+ await this.refreshWarehouseOutStock(
|
|
|
+ index,
|
|
|
+ this.form.datasource[index]
|
|
|
);
|
|
|
} else {
|
|
|
//不存在
|
|
|
@@ -1744,6 +1753,8 @@
|
|
|
// 设置为不存在的批次ID
|
|
|
this.$set(this.form.datasource[index], 'batchStockId', 999);
|
|
|
this.$set(this.form.datasource[index], 'warehouseNum', '');
|
|
|
+ this.$set(this.form.datasource[index], 'stockCountBase', '');
|
|
|
+ this.$set(this.form.datasource[index], 'availableCountBase', '');
|
|
|
this.$set(this.form.datasource[index], 'warehouseId', '');
|
|
|
}
|
|
|
|
|
|
@@ -1769,6 +1780,8 @@
|
|
|
);
|
|
|
this.$set(this.form.datasource[index], 'batchStockId', 999);
|
|
|
this.$set(this.form.datasource[index], 'warehouseNum', '');
|
|
|
+ this.$set(this.form.datasource[index], 'stockCountBase', '');
|
|
|
+ this.$set(this.form.datasource[index], 'availableCountBase', '');
|
|
|
}
|
|
|
}
|
|
|
},
|