|
|
@@ -179,9 +179,11 @@
|
|
|
fixed="left"
|
|
|
:selectable="
|
|
|
(row) => {
|
|
|
- return !this.productLists.some(
|
|
|
- (it) => it.categoryId == row.categoryId
|
|
|
- ) && row.measureQuantity != 0;
|
|
|
+ return (
|
|
|
+ !this.productLists.some(
|
|
|
+ (it) => it.categoryId == row.categoryId
|
|
|
+ ) && this.getAvailableQuantity(row) > 0
|
|
|
+ );
|
|
|
}
|
|
|
"
|
|
|
>
|
|
|
@@ -195,7 +197,10 @@
|
|
|
fixed="left"
|
|
|
:selectable="
|
|
|
(row) => {
|
|
|
- return !this.productLists.some((it) => it.id == row.id) && row.measureQuantity != 0;
|
|
|
+ return (
|
|
|
+ !this.productLists.some((it) => it.id == row.id) &&
|
|
|
+ this.getAvailableQuantity(row) > 0
|
|
|
+ );
|
|
|
}
|
|
|
"
|
|
|
>
|
|
|
@@ -287,6 +292,7 @@
|
|
|
prop="measureQuantity"
|
|
|
label="计量数量"
|
|
|
width="120"
|
|
|
+ :formatter="formatMeasureQuantity"
|
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
|
prop="measureUnit"
|
|
|
@@ -480,6 +486,23 @@
|
|
|
formatSystemBatchNo(row) {
|
|
|
return row.systemBatchNo || '-';
|
|
|
},
|
|
|
+ // 批次入库数量不会随出库变化,发货选择必须使用当前库存余额扣除锁定量。
|
|
|
+ getAvailableQuantity(row) {
|
|
|
+ const inventoryBalance =
|
|
|
+ Number(
|
|
|
+ this.dimension == 2 ? row.availableCountBase : row.measureQuantity
|
|
|
+ ) || 0;
|
|
|
+ const lockQuantity = Number(row.lockQuantity) || 0;
|
|
|
+ return Math.max(
|
|
|
+ 0,
|
|
|
+ Math.round((inventoryBalance - lockQuantity) * 100) / 100
|
|
|
+ );
|
|
|
+ },
|
|
|
+ formatMeasureQuantity(row) {
|
|
|
+ return this.dimension == 2
|
|
|
+ ? this.getAvailableQuantity(row)
|
|
|
+ : row.measureQuantity;
|
|
|
+ },
|
|
|
async getFactoryList() {
|
|
|
const res = await warehouseDefinition.getFactoryarea({
|
|
|
pageNum: 1,
|
|
|
@@ -529,7 +552,8 @@
|
|
|
},
|
|
|
// 出库数量限制
|
|
|
handleInput(row, value) {
|
|
|
- if (row.outboundNum <= row.measureQuantity) {
|
|
|
+ const availableQuantity = this.getAvailableQuantity(row);
|
|
|
+ if (row.outboundNum <= availableQuantity) {
|
|
|
// return (row.outboundNum = value.replace(/^(0+)|[^\d]+/g, ''));
|
|
|
|
|
|
// 过滤掉非数字和小数点的字符
|
|
|
@@ -547,7 +571,7 @@
|
|
|
}
|
|
|
return (row.outboundNum = finalValue);
|
|
|
} else {
|
|
|
- row.outboundNum = row.measureQuantity;
|
|
|
+ row.outboundNum = availableQuantity;
|
|
|
}
|
|
|
},
|
|
|
// 切换维度
|
|
|
@@ -569,7 +593,7 @@
|
|
|
// 批次维度
|
|
|
const data = await storageApi.getBatchList(this.searchForm);
|
|
|
for (let i = 0; i < data.list.length; i++) {
|
|
|
- data.list[i].outboundNum = data.list[i].measureQuantity;
|
|
|
+ data.list[i].outboundNum = this.getAvailableQuantity(data.list[i]);
|
|
|
}
|
|
|
this.tableData = data.list;
|
|
|
this.total = data.count;
|