Browse Source

小数位

master
han\hanst 9 hours ago
parent
commit
0ba97131a8
  1. 10
      src/views/modules/production-inbound/inboundRegister.vue
  2. 12
      src/views/modules/recv/recv.vue

10
src/views/modules/production-inbound/inboundRegister.vue

@ -212,9 +212,9 @@ export default {
totalQty() {
// 使
const sumInCents = this.handlingUnit.reduce((sum, item) => {
return sum + Math.round(Number(item.qty) * 100);
return sum + Math.round(Number(item.qty) * 10000);
}, 0);
const sum = sumInCents / 100;
const sum = sumInCents / 10000;
this.inboundItem.transQty = sum;
return sum;
},
@ -432,8 +432,8 @@ export default {
const packageQty = Math.floor(qtyToReceive / perQtyValue);
// 使
const remainderInCents = Math.round(qtyToReceive * 100) - Math.round(perQtyValue * 100) * packageQty;
const remainder = remainderInCents / 100;
const remainderInCents = Math.round(qtyToReceive * 10000) - Math.round(perQtyValue * 10000) * packageQty;
const remainder = remainderInCents / 10000;
this.handlingUnit = [];
@ -475,7 +475,7 @@ export default {
return this.$message.warning("请填写有效的包装信息");
}
// 使
const qty = Math.round(parseFloat(perQty) * 100) * parseInt(packageQty) / 100;
const qty = Math.round(parseFloat(perQty) * 10000) * parseInt(packageQty) / 10000;
const code = String(this.handlingUnit.length + 1);
const newItem = { ...this.hanlingItem, qty, code };
this.handlingUnit.push(newItem);

12
src/views/modules/recv/recv.vue

@ -194,9 +194,9 @@ export default {
totalQty() {
// 使
const sumInCents = this.handlingUnit.reduce((sum, item) => {
return sum + Math.round(Number(item.qty) * 100);
return sum + Math.round(Number(item.qty) * 10000);
}, 0);
const sum = sumInCents / 100;
const sum = sumInCents / 10000;
this.recvItem.transQty = sum;
return sum;
},
@ -367,7 +367,7 @@ export default {
if (qtyToReceive <= 0) {
qtyToReceive = parseFloat(this.recvItem.qtyToReceive) || 0;
}
if (qtyToReceive <= 0) {
this.$message.warning('待收数量为0,无法自动计算包装');
this.hanlingItem.perQty = '';
@ -379,8 +379,8 @@ export default {
//
const packageQty = Math.floor(qtyToReceive / perQtyValue);
// - 使
const remainderInCents = Math.round(qtyToReceive * 100) - Math.round(perQtyValue * 100) * packageQty;
const remainder = remainderInCents / 100;
const remainderInCents = Math.round(qtyToReceive * 10000) - Math.round(perQtyValue * 10000) * packageQty;
const remainder = remainderInCents / 10000;
// HU
this.handlingUnit = [];
@ -428,7 +428,7 @@ export default {
return this.$message.warning("请填写有效的包装信息");
}
// 使
const qty = Math.round(parseFloat(perQty) * 100) * parseInt(packageQty) / 100;
const qty = Math.round(parseFloat(perQty) * 10000) * parseInt(packageQty) / 10000;
const code = String(this.handlingUnit.length + 1);
const newItem = { ...this.hanlingItem, qty, code };
this.handlingUnit.push(newItem);

Loading…
Cancel
Save