|
@@ -3442,16 +3442,40 @@ export default {
|
|
|
getTotalNum(data) {
|
|
|
//通过车序号的个数来计算车数
|
|
|
let arr = []
|
|
|
+ let arrNetAmount = []
|
|
|
+ let noWeightBatchIdList = []
|
|
|
+ let weightBatchIdList = []
|
|
|
+ let totalWeightList = []
|
|
|
+ let hash = {}
|
|
|
arr = data.map(e => {
|
|
|
return e.saleOrderMaterialId
|
|
|
})
|
|
|
+ noWeightBatchIdList = data.reduce((prev, item) => {
|
|
|
+ if (!item.weightBatchId) {
|
|
|
+ prev.push(item)
|
|
|
+ }
|
|
|
+ return prev
|
|
|
+ }, [])
|
|
|
+ weightBatchIdList = data.reduce((prev, item) => {
|
|
|
+ if (item.weightBatchId) {
|
|
|
+ prev.push(item)
|
|
|
+ }
|
|
|
+ return prev
|
|
|
+ }, [])
|
|
|
+ arrNetAmount = weightBatchIdList.reduce(function(prev, item, index, arr) {
|
|
|
+ hash[item.weightBatchId]
|
|
|
+ ? null
|
|
|
+ : (hash[item.weightBatchId] = true && prev.push(item))
|
|
|
+ return prev
|
|
|
+ }, [])
|
|
|
+ totalWeightList = noWeightBatchIdList.concat(arrNetAmount)
|
|
|
this.totalCapacity = Array.from(new Set(arr)).length
|
|
|
this.totalNetWeight =
|
|
|
- data.reduce(function(prev, item) {
|
|
|
+ totalWeightList.reduce(function(prev, item, index) {
|
|
|
return prev + item.netWeight * 1000
|
|
|
}, 0) / 1000
|
|
|
this.totalDetailsAmount =
|
|
|
- data.reduce((prev, item) => {
|
|
|
+ totalWeightList.reduce((prev, item) => {
|
|
|
return prev + item.detailsAmount * 1000
|
|
|
}, 0) / 1000
|
|
|
},
|
|
@@ -3459,16 +3483,44 @@ export default {
|
|
|
getTotalNumSettled(data) {
|
|
|
//通过车序号的个数来计算车数
|
|
|
let arr = []
|
|
|
+ let arrNetAmount = []
|
|
|
+ let noWeightBatchIdList = []
|
|
|
+ let weightBatchIdList = []
|
|
|
+ let totalWeightList = []
|
|
|
+ let hash = {}
|
|
|
arr = data.map(e => {
|
|
|
return e.saleOrderMaterialId
|
|
|
})
|
|
|
+ noWeightBatchIdList = data.reduce((prev, item) => {
|
|
|
+ if (!item.weightBatchId) {
|
|
|
+ prev.push(item)
|
|
|
+ }
|
|
|
+ return prev
|
|
|
+ }, [])
|
|
|
+ weightBatchIdList = data.reduce((prev, item) => {
|
|
|
+ if (item.weightBatchId) {
|
|
|
+ prev.push(item)
|
|
|
+ }
|
|
|
+ return prev
|
|
|
+ }, [])
|
|
|
+ arrNetAmount = weightBatchIdList.reduce(function(prev, item, index, arr) {
|
|
|
+ if (item.weightBatchId) {
|
|
|
+ hash[item.weightBatchId]
|
|
|
+ ? ''
|
|
|
+ : (hash[item.weightBatchId] = true && prev.push(item))
|
|
|
+ return prev
|
|
|
+ } else {
|
|
|
+ return prev.push(item)
|
|
|
+ }
|
|
|
+ }, [])
|
|
|
+ totalWeightList = noWeightBatchIdList.concat(arrNetAmount)
|
|
|
this.setteldTotalCapacity = Array.from(new Set(arr)).length
|
|
|
this.totalNetWeightSettled =
|
|
|
- data.reduce(function(prev, item) {
|
|
|
+ totalWeightList.reduce(function(prev, item) {
|
|
|
return prev + item.netWeight * 1000
|
|
|
}, 0) / 1000
|
|
|
this.totalDetailsAmountSettled =
|
|
|
- data.reduce((prev, item) => {
|
|
|
+ totalWeightList.reduce((prev, item) => {
|
|
|
return prev + item.detailsAmount * 1000
|
|
|
}, 0) / 1000
|
|
|
},
|