Browse Source

精度问题

hella_online_20240829
zhang_li 4 months ago
parent
commit
c7e49b674d
  1. 47
      src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/labelForm.vue

47
src/views/wms/purchasereceiptManage/supplierdeliver/supplierdeliverRequestMain/labelForm.vue

@ -12,7 +12,12 @@
<template #default="scope">
<div
style="margin-left: 400px; margin-top: -8px; margin-bottom: -8px"
v-if="scope.row.packUnit && scope.row.packQty && scope.row.secondPackUnit && scope.row.secondPackQty"
v-if="
scope.row.packUnit &&
scope.row.packQty &&
scope.row.secondPackUnit &&
scope.row.secondPackQty
"
>
<el-table
:data="scope.row.packageList"
@ -102,10 +107,14 @@
</el-table-column>
</el-table>
</div>
<div style="margin-left: 550px; margin-top: -8px; margin-bottom: -8px" v-if="scope.row.packUnit && scope.row.packQty && !scope.row.secondPackUnit">
<div
style="margin-left: 550px; margin-top: -8px; margin-bottom: -8px"
v-if="scope.row.packUnit && scope.row.packQty && !scope.row.secondPackUnit"
>
<div v-for="(item, index) in scope.row.packageList" :key="index">
<el-table :data="item.children" border style="width: 300px" row-key="id">
<el-table-column label="箱行号" width="100" prop="xPoNumber" align="center" > <template #default="scope1">
<el-table-column label="箱行号" width="100" prop="xPoNumber" align="center">
<template #default="scope1">
{{ scope1.$index + 1 }}
</template>
</el-table-column>
@ -130,7 +139,7 @@
<el-button
type="warning"
link
@click="removeX(scope.row, scope.$index, item, index)"
@click="removeX(scope.row, scope.$index, item, index,scope1.row, scope1.$index )"
>移出</el-button
>
</template>
@ -225,12 +234,12 @@ const expandChange = (row: any, expandedRows: any[]) => {
//
row.manTuoQty = Math.floor(parseFloat(row.manXiangQty) / parseFloat(row.otherNumber))
// **
row.tuoInManNumber =
parseFloat(row.manTuoQty) * parseFloat(row.otherNumber) * parseFloat(row.packQty)
let num1 = accuracyFun.multiply(parseFloat(row.manTuoQty ),parseFloat(row.otherNumber))
row.tuoInManNumber =accuracyFun.multiply(num1,parseFloat(row.packQty))
//
row.lastNumber =
parseFloat(row.qty) > parseFloat(row.tuoInManNumber)
? parseFloat(row.qty) - parseFloat(row.tuoInManNumber)
? accuracyFun.subtract( parseFloat(row.qty),parseFloat(row.tuoInManNumber))
: parseFloat(row.qty)
//
row.packageList =[]
@ -259,7 +268,7 @@ const expandChange = (row: any, expandedRows: any[]) => {
} else {
// ,
row.packageList[i].xNumber = row.otherNumber
row.packageList[i].qtyOne = parseFloat(row.otherNumber) * parseFloat(row.packQty)
row.packageList[i].qtyOne = accuracyFun.multiply( parseFloat(row.otherNumber),parseFloat(row.packQty))
}
}
//
@ -417,7 +426,7 @@ const addT = (oneRow) => {
}
//
const removeT = (oneRow, oneIndex, twoRow, twoIndex) => {
oneRow.packageList.splice(twoIndex, 1)
oneRow.packageList= oneRow.packageList.filter(item=>item.id!=twoRow.id)
oneRow.allTuoQty = oneRow.packageList.length
}
//
@ -437,7 +446,7 @@ const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => {
twoRow.xNumber = twoRow.children.length
let num = 0
twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0
num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo) || 0)
})
twoRow.qtyOne = num
} else {
@ -447,9 +456,8 @@ const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => {
id: twoId.value,
// xPoNumber:
// twoRow.children.length > 0 ? twoRow.children[twoRow.children.length - 1].xPoNumber + 1 : 1,
// qtyTwo: oneRow.packQty
qtyTwo: oneRow.packQty
})
oneRow.allTuoQty = twoRow.children.length
}
}
//
@ -457,16 +465,15 @@ const removeX = (oneRow, oneIndex, twoRow, twoIndex, threeRow, threeIndex, type)
//
if (type == 1) {
//
twoRow.children.splice(threeIndex, 1)
twoRow.children= twoRow.children.filter(item=>item.id!=threeRow.id)
let num = 0
twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0
num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo) || 0)
})
twoRow.qtyOne = num
twoRow.xNumber = twoRow.children.length
} else {
twoRow.children.splice(twoIndex, 1)
oneRow.allTuoQty = twoRow.children.length
twoRow.children= twoRow.children.filter(item=>item.id!=threeRow.id)
}
}
//
@ -486,7 +493,9 @@ const blurOne = (oneRow, twoRow) => {
// twoRow.children = []
// twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.packQty)
// }
twoRow.qtyOne = parseFloat(twoRow.xNumber)? parseFloat(twoRow.xNumber)* parseFloat(oneRow.packQty) : ''
twoRow.qtyOne = parseFloat(twoRow.xNumber) ?
accuracyFun.multiply( parseFloat(twoRow.xNumber),parseFloat(oneRow.packQty))
: ''
// let num = 0
// oneRow.packageList.forEach((item) => {
// num += parseFloat(item.xNumber) || 0
@ -544,7 +553,7 @@ const blurTwo = (oneRow, twoRow, threeRow) => {
// }
let num = 0
twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0
num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo))
})
twoRow.qtyOne = num
}
@ -556,7 +565,7 @@ const blurThree = (oneRow, twoRow, thereeRow) => {
// }
let num = 0
twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0
num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo))
})
twoRow.qtyOne = num
}

Loading…
Cancel
Save