Commit 691faf3a authored by dragondean@qq.com's avatar dragondean@qq.com

完善拆单操作

parent f9be6a38
......@@ -46,6 +46,10 @@ export default {
align-items: center;
justify-content: center;
}
.flex-between{
display: flex;
justify-content: space-between;
}
.empty-placeholder{
padding: 50px;
text-align: center;
......
......@@ -283,7 +283,13 @@
</template>
</el-table-column>
</el-table>
<div class="page-title">{{$t('已放入入仓记录')}}</div>
<div class="flex-between mt-20 mb-10">
<div class="page-title" style="margin: 0">
{{$t('已放入入仓记录')}}
</div>
<el-button type="danger" size="mini" @click="clearAll">清空放入数据</el-button>
</div>
<el-table
:data="shopForm.specsRecordVOList"
style="width: 100%">
......@@ -788,8 +794,8 @@ export default {
this.$message.success(this.$t("放入成功"));
this.querySplitGoods();
this.$refs["shopForm"].resetFields();
});
this.shopOpen = false;
});
}
});
},
......@@ -892,6 +898,12 @@ export default {
this.shopForm.specsRecordVOList.push({...item})
})
this.currentPutIn = null
},
// 清空放入记录
clearAll(){
this.$confirm(this.$t("确定要清空放入数据么?")).then(res => {
this.shopForm.specsRecordVOList = []
})
}
},
};
......
......@@ -4,8 +4,8 @@
<el-card>
<div slot="header">{{$t('可拆出入仓记录')}}</div>
<el-table :data="[warehouseRecord]">
<el-table-column :label="$t('剩余') +'/'+ $t('箱数')" prop="cartonsNum">
<template slot-scope="{row}">{{leftData('num')}}/{{row.cartonsNum}}</template>
<el-table-column :label="$t('箱数')" prop="cartonsNum">
<template slot-scope="{row}">{{row.cartonsNum}}</template>
</el-table-column>
<el-table-column :label="$t('入仓类型')" prop="specificationType">
<template slot-scope="{row}">
......@@ -45,6 +45,12 @@
</template>
</el-table-column>
</el-table>
<div>
{{$t('剩余')}}:
{{leftData('num')}}{{$t('箱')}},
{{$t('体积')}}:{{leftData('volume')}}{{$t('m³')}},
{{$t('重量')}}:{{leftData('weight')}}{{$t('kg')}}
</div>
</el-card>
<el-card class="box-card mt-10">
<div slot="header" class="clearfix">
......@@ -243,18 +249,24 @@ export default {
},
// 剩余数据
leftData(){
return field => {
return (field, containNew = false) => {
// 入仓记录跟拆单记录的箱数字段不同,要做特殊处理
let left = new Decimal(this.warehouseRecord[field == 'num' ? 'cartonsNum' : field] || 0)
console.log('leftData', left.toNumber())
// 累减已拆记录
if(this.warehouseRecord.specsRecordVOList && this.warehouseRecord.specsRecordVOList.length){
this.warehouseRecord.specsRecordVOList.forEach(item => {
left = left.minus(new Decimal(item[field] || 0))
})
}
// 如果是包含新数据(本次放入数据)
if(containNew){
// 累减本页添加的入仓记录
this.form.list.forEach(item => {
left = left.minus(new Decimal(item[field] || 0))
})
}
return left.toNumber()
}
}
......@@ -271,7 +283,10 @@ export default {
// 根据入仓记录添加一行
this.form.list.push({
warehouseInId: this.warehouseRecord.id,
specificationType, boxGauge1, boxGauge2, boxGauge3, volume, weight,num,
specificationType, boxGauge1, boxGauge2, boxGauge3,
volume: this.leftData('volume', true),
weight: this.leftData('weight', true),
num: this.leftData('num', true),
orderLocationList: this.warehouseRecord.orderLocationBackVOList
})
},
......@@ -312,8 +327,15 @@ export default {
if(!valid){
return false
}
if(this.splitTotal('num') > this.warehouseRecord.cartonsNum){
return this.$message.error("拆出箱数不能大于原入仓箱数")
if(this.splitTotal('num') > this.leftData('num')){
return this.$message.error("拆出箱数不能大于剩余箱数")
}
if(this.splitTotal('volume') > this.leftData('volume')){
return this.$message.error("拆出体积不能大于剩余体积")
}
if(this.splitTotal('weight') > this.leftData('weight')){
return this.$message.error("拆出重量不能大于剩余重量")
}
// 如果全拆(拆出箱数 == 原入仓箱数),则体积重量也需要全拆
if(this.splitTotal('num') === this.warehouseRecord.cartonsNum){
......
......@@ -314,7 +314,12 @@
</template>
</el-table-column>
</el-table>
<div class="page-title">{{$t('已放入入仓记录')}}</div>
<div class="flex-between mt-20 mb-10">
<div class="page-title" style="margin: 0">
{{$t('已放入入仓记录')}}
</div>
<el-button type="danger" size="mini" @click="clearAll">清空放入数据</el-button>
</div>
<el-table
:data="shopForm.specsRecordVOList"
style="width: 100%">
......@@ -1091,7 +1096,7 @@ export default {
putInRecord(row){
this.currentPutIn = row
// 此条入仓记录已拆出的入仓记录,这样在放入的时候可以确保不超过此入仓记录的数量
let specsRecordVOList = this.getWarehouseInspecsRecordVOList(getWarehouseInspecsRecordVOList)
let specsRecordVOList = this.getWarehouseInspecsRecordVOList(row.id)
this.currentPutIn.specsRecordVOList = specsRecordVOList
},
// 放入回调
......@@ -1103,6 +1108,12 @@ export default {
this.shopForm.specsRecordVOList.push({...item})
})
this.currentPutIn = null
},
// 清空放入记录
clearAll(){
this.$confirm(this.$t("确定要清空放入数据么?")).then(res => {
this.shopForm.specsRecordVOList = []
})
}
}
}
......
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