Commit 95e5257a authored by dragondean@qq.com's avatar dragondean@qq.com

拆单自动重置数据,出货拆单放入箱数可修改

parent 83bb0331
......@@ -226,7 +226,7 @@
</el-col>-->
</el-row>
<el-form-item :label="$t('放入箱数')+':'">
{{shopForm.num||0}}
<el-input-number v-model="shopForm.num" controls-position="right" :min="0" :max="+shopForm.leftNum" @change="calcAverg"></el-input-number>
</el-form-item>
......@@ -406,14 +406,6 @@ export default {
});
return _total;
},
/*totalSplitQty() {
let _total = 0;
const { orderSplitItemBackVOList = [] } = this.splitData;
orderSplitItemBackVOList.forEach((v) => {
_total = Decimal.add(_total, Number(v.quantity)).toNumber();
});
return _total;
},*/
/* 打开拆单 */
getSplit() {
this.orderItems = this.currRow.goodsList ?? [];
......@@ -546,11 +538,12 @@ export default {
leftNum = Math.min(leftNum, this.mainOrderItem.num)
// 放入箱数
this.$set(this.shopForm, 'num', leftNum)
this.calcAverg()
},
// 按比例计算体积重量的默认值
calcAverg(){
// 装箱比例
const rate = leftNum / this.mainOrderItem.num
const rate = this.shopForm.num / this.mainOrderItem.num
// 放入个数,剩余个数是算不出来的,因为不知道已装数量,所以放入数量只能按照总数的比例计算
this.$set(this.shopForm, 'quantity', Math.ceil(this.mainOrderItem.quantity*rate|| 0 * rate))
......@@ -560,60 +553,6 @@ export default {
this.$set(this.shopForm, 'weight', (this.mainOrderItem.weight * rate).toFixed(2))
this.$set(this.shopForm, 'chargeWeight', (this.mainOrderItem.chargeWeight * rate).toFixed(2))
},
/*async changeProdTitleZh() {
const item = this.setShopForm("zhId");
this.shopForm.enId = item.id;
this.shopForm = { ...this.shopForm };
await this.getSelectData(item);
},
async changeProdTitleEn() {
const item = this.setShopForm("enId");
this.shopForm.zhId = item.id;
this.shopForm = { ...this.shopForm };
await this.getSelectData(item);
},
setShopForm(key) {
let list = [];
list = this.orderItems.filter((item) => item.id == this.shopForm[key]);
const data = list[0];
const itemNum = data.num ?? 0;
const itemQty = data.quantity ?? 0;
// 获取拆单项的总num
const total = this.totalSplitNum();
// 订单的剩余
const orderNum = this.currRow.num - this.currRow.installNum;
// 剩余可装
const remainNum = Decimal.sub(orderNum, total).toNumber();
this.shopForm.num = 0;
this.shopForm.putNum = 0;
// 剩余可装大于等于订单项剩余,显示订单剩余
if (remainNum >= itemNum) {
this.shopForm.num = remainNum;
this.shopForm.putNum = itemNum;
}
// 订单剩余小于订单项剩余,显示订单项剩余
if (remainNum < itemNum) {
this.shopForm.num = this.shopForm.putNum = remainNum;
}
const totalQty = this.totalSplitQty();
this.shopForm.quantity = 0;
if (totalQty >= itemQty) {
this.shopForm.quantity = totalQty;
}
if (totalQty < itemQty) {
this.shopForm.quantity = itemQty;
}
this.shopForm.orderItemId = data.orderItemId;
this.shopForm.putQuantity = Decimal.div(
this.shopForm.quantity,
this.shopForm.num
).toFixed(0);
return data;
},*/
async getSelectData(item) {
await quantityRequired(this.orderData.lineId).then((res) => {
if (res.data) {
......
......@@ -382,12 +382,16 @@ export default {
Promise.all([this.getList(), this.getOrder()]).then(res => {
console.log("拆单数据", this.splitData, this.splitData.length)
if(this.orderData.inWarehouseState != 207 && this.splitData.length){
this.$confirm(this.$t('已有拆单数据,是否要重置?')).then(res => {
// 2023-05-20确认不需要询问,直接重置
deleteAllSplit(this.queryParams.orderId).then(res => {
this.getList()
})
/*this.$confirm(this.$t('已有拆单数据,是否要重置?')).then(res => {
return deleteAllSplit(this.queryParams.orderId)
}).then(res => {
this.getList()
this.$message.success("重置成功")
})
})*/
}
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment