|
|
|
@ -139,7 +139,7 @@ |
|
|
|
> |
|
|
|
</el-switch> |
|
|
|
<span v-if="autoCalculate" style="font-size: 13px; color: #17B3A3; margin-top: 5px; display: block; font-weight: bold;"> |
|
|
|
💡 输入单包装数量后,按回车键或点击确定按钮 |
|
|
|
💡 输入单包装数量后按回车,将根据未完成数量自动分配包装 |
|
|
|
</span> |
|
|
|
<span v-else style="font-size: 12px; color: #999; margin-top: 5px; display: block;"> |
|
|
|
手动输入单包装数量和包装数,然后点击"创建"按钮 |
|
|
|
@ -402,7 +402,7 @@ export default { |
|
|
|
}, |
|
|
|
handlingUnitStep() { |
|
|
|
this.processFlag = 3; |
|
|
|
this.autoCalculate = false; // 默认使用自动计算模式 |
|
|
|
this.autoCalculate = false; // 默认使用手动输入模式 |
|
|
|
const saved = localStorage.getItem(this.huKey); |
|
|
|
this.handlingUnit = saved ? JSON.parse(saved) : []; |
|
|
|
}, |
|
|
|
@ -417,15 +417,20 @@ export default { |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const qtyToReceive = parseFloat(this.inboundItem.transQty) || 0; |
|
|
|
// 优先使用"此次入库数量",如果没有则使用"未完成数量" |
|
|
|
let qtyToReceive = parseFloat(this.inboundItem.transQty) || 0; |
|
|
|
if (qtyToReceive <= 0) { |
|
|
|
this.$message.warning('请先输入入库数量'); |
|
|
|
qtyToReceive = parseFloat(this.inboundItem.unCompleteQty) || 0; |
|
|
|
} |
|
|
|
|
|
|
|
if (qtyToReceive <= 0) { |
|
|
|
this.$message.warning('未完成数量为0,无法自动计算包装'); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
const perQtyValue = parseFloat(perQty); |
|
|
|
const packageQty = Math.floor(qtyToReceive / perQtyValue); |
|
|
|
|
|
|
|
|
|
|
|
// 使用整数运算避免浮点数精度问题 |
|
|
|
const remainderInCents = Math.round(qtyToReceive * 100) - Math.round(perQtyValue * 100) * packageQty; |
|
|
|
const remainder = remainderInCents / 100; |
|
|
|
|