|
|
@@ -310,7 +310,7 @@
|
|
|
// console.log(row);
|
|
|
return (
|
|
|
_this.productLists.some((it) => it.categoryId == row.categoryId) ||
|
|
|
- _this.dimension == '3' || row.measureQuantity == 0
|
|
|
+ _this.dimension == '3' || row.availableQuantity == 0
|
|
|
);
|
|
|
};
|
|
|
},
|
|
|
@@ -413,7 +413,7 @@
|
|
|
return (
|
|
|
!_this.productLists.some((item) =>
|
|
|
_this.isSameStockRecord(item, row)
|
|
|
- ) && row.measureQuantity != 0
|
|
|
+ ) && row.availableQuantity != 0
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
@@ -428,7 +428,7 @@
|
|
|
return (
|
|
|
!_this.productLists.some((item) =>
|
|
|
_this.isSameStockRecord(item, row)
|
|
|
- ) && row.measureQuantity != 0
|
|
|
+ ) && row.availableQuantity != 0
|
|
|
);
|
|
|
}
|
|
|
},
|
|
|
@@ -474,13 +474,13 @@
|
|
|
label: '可用数量',
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true,
|
|
|
- formatter: (row) => {
|
|
|
- // 使用整数运算避免浮点数精度丢失
|
|
|
- const measure = Number(row.measureQuantity) || 0;
|
|
|
- const lock = Number(row.lockQuantity) || 0;
|
|
|
- const result = (measure * 100 - lock * 100) / 100;
|
|
|
- return Math.round(result * 100) / 100;
|
|
|
- }
|
|
|
+ // formatter: (row) => {
|
|
|
+ // // 使用整数运算避免浮点数精度丢失
|
|
|
+ // const measure = Number(row.measureQuantity) || 0;
|
|
|
+ // const lock = Number(row.lockQuantity) || 0;
|
|
|
+ // const result = (measure * 100 - lock * 100) / 100;
|
|
|
+ // return Math.round(result * 100) / 100;
|
|
|
+ // }
|
|
|
},
|
|
|
{
|
|
|
prop: 'inventoryCycle',
|
|
|
@@ -622,7 +622,7 @@
|
|
|
|
|
|
// 出库数量限制
|
|
|
handleInput(row, value) {
|
|
|
- if (row.outboundNum <= row.measureQuantity) {
|
|
|
+ if (row.outboundNum <= row.availableQuantity) {
|
|
|
// return (row.outboundNum = value.replace(/^(0+)|[^\d]+/g, ''));
|
|
|
|
|
|
// 过滤掉非数字和小数点的字符
|
|
|
@@ -645,7 +645,7 @@
|
|
|
}
|
|
|
return
|
|
|
} else {
|
|
|
- row.outboundNum = row.measureQuantity;
|
|
|
+ row.outboundNum = row.availableQuantity;
|
|
|
const currentIndex = this.selectionList.findIndex(item => item.id === row.id)
|
|
|
if(currentIndex > -1) {
|
|
|
this.$set(this.selectionList, currentIndex, row);
|
|
|
@@ -673,13 +673,25 @@
|
|
|
...this.searchForm,
|
|
|
isEnabled: 1
|
|
|
});
|
|
|
- this.tableData = data.list;
|
|
|
+ this.tableData = data.list.map(item => {
|
|
|
+ const measure = Number(item.measureQuantity) || 0;
|
|
|
+ const lock = Number(item.lockQuantity) || 0;
|
|
|
+ const result = (measure * 100 - lock * 100) / 100;
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ availableQuantity: Math.round(result * 100) / 100
|
|
|
+ }
|
|
|
+ });
|
|
|
this.total = data.count;
|
|
|
} else if (this.dimension == 2) {
|
|
|
// 批次维度
|
|
|
const data = await storageApi.getBatchList(this.searchForm);
|
|
|
for (let i = 0; i < data.list.length; i++) {
|
|
|
- data.list[i].outboundNum = data.list[i].measureQuantity;
|
|
|
+ const measure = Number(item.measureQuantity) || 0;
|
|
|
+ const lock = Number(item.lockQuantity) || 0;
|
|
|
+ const result = (measure * 100 - lock * 100) / 100;
|
|
|
+ data.list[i].availableQuantity = Math.round(result * 100) / 100;
|
|
|
+ data.list[i].outboundNum = data.list[i].availableQuantity;
|
|
|
}
|
|
|
this.tableData = data.list;
|
|
|
this.total = data.count;
|
|
|
@@ -688,12 +700,24 @@
|
|
|
const data = await storageApi.getMaterialList({
|
|
|
...this.searchForm
|
|
|
});
|
|
|
- this.tableData = data.list;
|
|
|
+ this.tableData = data.list.map(item => {
|
|
|
+ const measure = Number(item.measureQuantity) || 0;
|
|
|
+ const lock = Number(item.lockQuantity) || 0;
|
|
|
+ const result = (measure * 100 - lock * 100) / 100;
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ availableQuantity: Math.round(result * 100) / 100
|
|
|
+ }
|
|
|
+ });
|
|
|
this.total = data.count;
|
|
|
} else {
|
|
|
// 包装维度
|
|
|
const data = await storageApi.getPackingList(this.searchForm);
|
|
|
for (let i = 0; i < data.list.length; i++) {
|
|
|
+ const measure = Number(item.measureQuantity) || 0;
|
|
|
+ const lock = Number(item.lockQuantity) || 0;
|
|
|
+ const result = (measure * 100 - lock * 100) / 100;
|
|
|
+ data.list[i].availableQuantity = Math.round(result * 100) / 100;
|
|
|
data.list[i].outboundNum = data.list[i].packingQuantity;
|
|
|
}
|
|
|
this.tableData = data.list;
|
|
|
@@ -897,6 +921,16 @@
|
|
|
// console.log(data);
|
|
|
// let result = this.updateSelect(data);
|
|
|
// return result;
|
|
|
+
|
|
|
+ data.list.forEach(item => {
|
|
|
+ // 使用整数运算避免浮点数精度丢失
|
|
|
+ const measure = Number(item.measureQuantity) || 0;
|
|
|
+ const lock = Number(item.lockQuantity) || 0;
|
|
|
+ const result = (measure * 100 - lock * 100) / 100;
|
|
|
+
|
|
|
+ item.availableQuantity = Math.round(result * 100) / 100;
|
|
|
+ });
|
|
|
+ console.log('dimension == 1~~~', data.list);
|
|
|
this.updateProductOutboundNums(data.list);
|
|
|
return data;
|
|
|
}
|
|
|
@@ -910,7 +944,12 @@
|
|
|
size: limit
|
|
|
});
|
|
|
data.list.forEach((item) => {
|
|
|
- item.outboundNum = item.measureQuantity;
|
|
|
+ const measure = Number(item.measureQuantity) || 0;
|
|
|
+ const lock = Number(item.lockQuantity) || 0;
|
|
|
+ const result = (measure * 100 - lock * 100) / 100;
|
|
|
+
|
|
|
+ item.availableQuantity = Math.round(result * 100) / 100;
|
|
|
+ item.outboundNum = item.availableQuantity;
|
|
|
});
|
|
|
return data;
|
|
|
}
|
|
|
@@ -924,6 +963,11 @@
|
|
|
size: limit
|
|
|
});
|
|
|
data.list.forEach((item) => {
|
|
|
+ const measure = Number(item.measureQuantity) || 0;
|
|
|
+ const lock = Number(item.lockQuantity) || 0;
|
|
|
+ const result = (measure * 100 - lock * 100) / 100;
|
|
|
+
|
|
|
+ item.availableQuantity = Math.round(result * 100) / 100;
|
|
|
item.outboundNum = item.packingQuantity;
|
|
|
});
|
|
|
this.updateProductOutboundNums(data.list);
|