Browse Source

精度问题

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

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

@ -12,7 +12,12 @@
<template #default="scope"> <template #default="scope">
<div <div
style="margin-left: 400px; margin-top: -8px; margin-bottom: -8px" 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 <el-table
:data="scope.row.packageList" :data="scope.row.packageList"
@ -102,13 +107,17 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </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"> <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 :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">
{{ scope1.$index + 1 }} <template #default="scope1">
</template> {{ scope1.$index + 1 }}
</el-table-column> </template>
</el-table-column>
<el-table-column label="数量" width="100" prop="qtyOne" align="center"> <el-table-column label="数量" width="100" prop="qtyOne" align="center">
<template #default="scope1"> <template #default="scope1">
<el-input <el-input
@ -130,7 +139,7 @@
<el-button <el-button
type="warning" type="warning"
link link
@click="removeX(scope.row, scope.$index, item, index)" @click="removeX(scope.row, scope.$index, item, index,scope1.row, scope1.$index )"
>移出</el-button >移出</el-button
> >
</template> </template>
@ -225,12 +234,12 @@ const expandChange = (row: any, expandedRows: any[]) => {
// //
row.manTuoQty = Math.floor(parseFloat(row.manXiangQty) / parseFloat(row.otherNumber)) row.manTuoQty = Math.floor(parseFloat(row.manXiangQty) / parseFloat(row.otherNumber))
// ** // **
row.tuoInManNumber = let num1 = accuracyFun.multiply(parseFloat(row.manTuoQty ),parseFloat(row.otherNumber))
parseFloat(row.manTuoQty) * parseFloat(row.otherNumber) * parseFloat(row.packQty) row.tuoInManNumber =accuracyFun.multiply(num1,parseFloat(row.packQty))
// //
row.lastNumber = row.lastNumber =
parseFloat(row.qty) > parseFloat(row.tuoInManNumber) parseFloat(row.qty) > parseFloat(row.tuoInManNumber)
? parseFloat(row.qty) - parseFloat(row.tuoInManNumber) ? accuracyFun.subtract( parseFloat(row.qty),parseFloat(row.tuoInManNumber))
: parseFloat(row.qty) : parseFloat(row.qty)
// //
row.packageList =[] row.packageList =[]
@ -259,7 +268,7 @@ const expandChange = (row: any, expandedRows: any[]) => {
} else { } else {
// , // ,
row.packageList[i].xNumber = row.otherNumber 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) => { 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 oneRow.allTuoQty = oneRow.packageList.length
} }
// //
@ -437,7 +446,7 @@ const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => {
twoRow.xNumber = twoRow.children.length twoRow.xNumber = twoRow.children.length
let num = 0 let num = 0
twoRow.children.forEach((item) => { twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0 num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo) || 0)
}) })
twoRow.qtyOne = num twoRow.qtyOne = num
} else { } else {
@ -447,9 +456,8 @@ const addX = (oneRow, oneIndex, twoRow, twoIndex, type) => {
id: twoId.value, id: twoId.value,
// xPoNumber: // xPoNumber:
// twoRow.children.length > 0 ? twoRow.children[twoRow.children.length - 1].xPoNumber + 1 : 1, // 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) { if (type == 1) {
// //
twoRow.children.splice(threeIndex, 1) twoRow.children= twoRow.children.filter(item=>item.id!=threeRow.id)
let num = 0 let num = 0
twoRow.children.forEach((item) => { twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0 num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo) || 0)
}) })
twoRow.qtyOne = num twoRow.qtyOne = num
twoRow.xNumber = twoRow.children.length twoRow.xNumber = twoRow.children.length
} else { } else {
twoRow.children.splice(twoIndex, 1) twoRow.children= twoRow.children.filter(item=>item.id!=threeRow.id)
oneRow.allTuoQty = twoRow.children.length
} }
} }
// //
@ -486,7 +493,9 @@ const blurOne = (oneRow, twoRow) => {
// twoRow.children = [] // twoRow.children = []
// twoRow.qtyOne = parseFloat(twoRow.xNumber) * parseFloat(oneRow.packQty) // 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 // let num = 0
// oneRow.packageList.forEach((item) => { // oneRow.packageList.forEach((item) => {
// num += parseFloat(item.xNumber) || 0 // num += parseFloat(item.xNumber) || 0
@ -544,7 +553,7 @@ const blurTwo = (oneRow, twoRow, threeRow) => {
// } // }
let num = 0 let num = 0
twoRow.children.forEach((item) => { twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0 num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo))
}) })
twoRow.qtyOne = num twoRow.qtyOne = num
} }
@ -556,7 +565,7 @@ const blurThree = (oneRow, twoRow, thereeRow) => {
// } // }
let num = 0 let num = 0
twoRow.children.forEach((item) => { twoRow.children.forEach((item) => {
num += parseFloat(item.qtyTwo) || 0 num = accuracyFun.add( parseFloat(num),parseFloat(item.qtyTwo))
}) })
twoRow.qtyOne = num twoRow.qtyOne = num
} }

Loading…
Cancel
Save