diff --git a/src/views/modules/production-inbound/inboundRegister.vue b/src/views/modules/production-inbound/inboundRegister.vue
index 0e8e4e8..f88f0c5 100644
--- a/src/views/modules/production-inbound/inboundRegister.vue
+++ b/src/views/modules/production-inbound/inboundRegister.vue
@@ -139,7 +139,7 @@
>
- 💡 输入单包装数量后,按回车键或点击确定按钮
+ 💡 输入单包装数量后按回车,将根据未完成数量自动分配包装
手动输入单包装数量和包装数,然后点击"创建"按钮
@@ -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;
diff --git a/src/views/modules/recv/recv.vue b/src/views/modules/recv/recv.vue
index 492960c..6d13e9c 100644
--- a/src/views/modules/recv/recv.vue
+++ b/src/views/modules/recv/recv.vue
@@ -121,7 +121,7 @@
>
- 💡 输入单包装数量后,按回车键或点击确定按钮
+ 💡 输入单包装数量后按回车,将根据待收数量自动分配包装
手动输入单包装数量和包装数,然后点击"创建"按钮
@@ -346,7 +346,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) : [];
},
@@ -362,10 +362,14 @@ export default {
return;
}
- // 获取待收数量
- const qtyToReceive = parseFloat(this.recvItem.qtyToReceive) || 0;
+ // 优先使用"此次接收数量",如果没有则使用"待收数量"
+ let qtyToReceive = parseFloat(this.recvItem.transQty) || 0;
if (qtyToReceive <= 0) {
- this.$message.warning('待收数量为0,无法创建HU');
+ qtyToReceive = parseFloat(this.recvItem.qtyToReceive) || 0;
+ }
+
+ if (qtyToReceive <= 0) {
+ this.$message.warning('待收数量为0,无法自动计算包装');
this.hanlingItem.perQty = '';
return;
}