Commit 6e090ec8 authored by dragondean@qq.com's avatar dragondean@qq.com

拆单的适配

parent 64232e37
...@@ -179,7 +179,7 @@ ...@@ -179,7 +179,7 @@
<el-button type="text" @click="showWarehouse(scope.row)">{{scope.row.num}}</el-button> <el-button type="text" @click="showWarehouse(scope.row)">{{scope.row.num}}</el-button>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="`${$t('数量')}($t('个')`" align="center"> <el-table-column :label="$t('数量(个)')" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{scope.row.quantity}}</span> <span>{{scope.row.quantity}}</span>
</template> </template>
...@@ -214,12 +214,12 @@ ...@@ -214,12 +214,12 @@
<el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="150px" inline> <el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="150px" inline>
<el-form-item :label="$t('中文品名')+':'" prop="orderItemId"> <el-form-item :label="$t('中文品名')+':'" prop="orderItemId">
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择中文品名')"> <el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择中文品名')">
<el-option v-for="item in orderItems" :label="item.prodTitleZh" :value="item.orderItemId" :key="item.id" :disabled="itemDisabled(item)"></el-option> <el-option v-for="item in orderItems" :label="item.prodTitleZh" :value="item.orderItemId" :key="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item :label="$t('英文品名')+':'" prop="orderItemId"> <el-form-item :label="$t('英文品名')+':'" prop="orderItemId">
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择英文品名')"> <el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择英文品名')">
<el-option v-for="item in orderItems" :label="item.prodTitleEn" :value="item.orderItemId" :key="item.id" :disabled="itemDisabled(item)"></el-option> <el-option v-for="item in orderItems" :label="item.prodTitleEn" :value="item.orderItemId" :key="item.id"></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
...@@ -487,6 +487,10 @@ export default { ...@@ -487,6 +487,10 @@ export default {
getOrderWarehouseIn(this.queryParams.orderId).then(res => { getOrderWarehouseIn(this.queryParams.orderId).then(res => {
this.warehouseInList = res.data this.warehouseInList = res.data
}) })
this.$nextTick(() => {
window.$vm = this
})
}, },
watch: { watch: {
//监听table这个对象 //监听table这个对象
...@@ -507,6 +511,16 @@ export default { ...@@ -507,6 +511,16 @@ export default {
}); });
}, },
}, },
// 切换放入品名
'shopForm.orderItemId'(){
// 默认取以前放入的品名
this.shopForm.specsRecordVOList = []
let specsRecordVOList = this.splitData.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId)?.specsRecordVOList || []
specsRecordVOList.forEach(item => {
const [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*')
this.shopForm.specsRecordVOList.push({...item, boxGauge1, boxGauge2, boxGauge3})
})
}
}, },
computed: { computed: {
isAudit() { isAudit() {
...@@ -603,14 +617,6 @@ export default { ...@@ -603,14 +617,6 @@ export default {
getWarehouseInspecsRecordVOList(){ getWarehouseInspecsRecordVOList(){
return warehouseInId => { return warehouseInId => {
let specsRecordVOList = [] let specsRecordVOList = []
// 这里是拆单已放入的
this.splitData.orderSplitItemBackVOList.forEach(splitItem => {
splitItem.specsRecordVOList.forEach(specs => {
if(specs.warehouseInId === warehouseInId){
specsRecordVOList.push(specs)
}
})
})
// 这里是正在操作放入,但是还没确定提交的 // 这里是正在操作放入,但是还没确定提交的
this.shopForm.specsRecordVOList.forEach(item => { this.shopForm.specsRecordVOList.forEach(item => {
if(item.warehouseInId == warehouseInId)specsRecordVOList.push(item) if(item.warehouseInId == warehouseInId)specsRecordVOList.push(item)
...@@ -652,9 +658,9 @@ export default { ...@@ -652,9 +658,9 @@ export default {
// 剩余可拆箱数 // 剩余可拆箱数
leftSplitNum(){ leftSplitNum(){
let num = this.maxNum - this.putin.num let num = this.maxNum - this.putin.num
this.splitData.orderSplitItemBackVOList.forEach(item =>{ /*this.splitData.orderSplitItemBackVOList.forEach(item =>{
num -= item.num num -= item.num
}) })*/
return num return num
} }
}, },
...@@ -696,13 +702,13 @@ export default { ...@@ -696,13 +702,13 @@ export default {
this.mainOrder = data.find(item => item.isMaster) this.mainOrder = data.find(item => item.isMaster)
}); });
}, },
itemDisabled(data) { /*itemDisabled(data) {
const { orderSplitItemBackVOList = [] } = this.splitData; const { orderSplitItemBackVOList = [] } = this.splitData;
const isExist = orderSplitItemBackVOList.find( const isExist = orderSplitItemBackVOList.find(
(item) => item.orderItemId === data.orderItemId (item) => item.orderItemId === data.orderItemId
); );
return isExist ? true : false; return isExist ? true : false;
}, },*/
/* 查询拆单项 */ /* 查询拆单项 */
querySplitGoods() { querySplitGoods() {
getSplitList({ getSplitList({
......
...@@ -230,7 +230,7 @@ export default { ...@@ -230,7 +230,7 @@ export default {
// 数量是否必须 // 数量是否必须
quantityshow: Boolean, quantityshow: Boolean,
// 最大可拆箱数,装柜拆单用 // 最大可拆箱数,装柜拆单用
maxNum: Number maxNum: Number,
}, },
data(){ data(){
return { return {
...@@ -242,7 +242,7 @@ export default { ...@@ -242,7 +242,7 @@ export default {
} }
}, },
computed:{ computed:{
// 计算总拆出数据 // 计算当前添加的多条入仓记录总拆出数据
splitTotal(){ splitTotal(){
return field => { return field => {
let total = new Decimal(0) let total = new Decimal(0)
...@@ -252,6 +252,18 @@ export default { ...@@ -252,6 +252,18 @@ export default {
return total.toNumber() return total.toNumber()
} }
}, },
// 计算此入仓记录全部拆出的数量,包含其他拆单订单的
totalSplitSum(){
return field => {
let total = new Decimal(0)
if(this.warehouseRecord.specsRecordVOList && this.warehouseRecord.specsRecordVOList.length){
this.warehouseRecord.specsRecordVOList.forEach(item => {
total = total.plus(new Decimal(item[field] || 0))
})
}
return total.plus(new Decimal(this.splitTotal('num'))).toNumber()
}
},
// 剩余数据 // 剩余数据
leftData(){ leftData(){
return (field, containNew = false) => { return (field, containNew = false) => {
...@@ -305,8 +317,17 @@ export default { ...@@ -305,8 +317,17 @@ export default {
quantity: 0, quantity: 0,
orderLocationList orderLocationList
} }
// 按照比例计算重量体积和数量 // 如果拆完了则剩下的全部放入,否则按照比例计算
this.calc(row) if(this.warehouseRecord.cartonsNum === this.totalSplitSum('num') + row.num) {
row.num = this.leftData('num')
row.volume = this.leftData('volume')
row.weight = this.leftData('weight')
row.quantity = this.leftData('quantity')
}else{
// 按照比例计算重量体积和数量
this.calc(row)
}
this.form.list.push(row) this.form.list.push(row)
}, },
// 删除一行,可选参数index表上行号,参数不是数字则删除最后一行 // 删除一行,可选参数index表上行号,参数不是数字则删除最后一行
......
...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
<span style="margin-left: 10px;">{{$t('箱数')}}:{{!scope.row.warehouseInInfoVO?0:scope.row.warehouseInInfoVO.cartonsNum}}</span> <span style="margin-left: 10px;">{{$t('箱数')}}:{{!scope.row.warehouseInInfoVO?0:scope.row.warehouseInInfoVO.cartonsNum}}</span>
<span style="margin-left: 10px;">{{$t('体积')}}:{{!scope.row.warehouseInInfoVO?0:scope.row.warehouseInInfoVO.volume}}m³</span> <span style="margin-left: 10px;">{{$t('体积')}}:{{!scope.row.warehouseInInfoVO?0:scope.row.warehouseInInfoVO.volume}}m³</span>
<span style="margin-left: 10px;">{{$t('重量')}}:{{!scope.row.warehouseInInfoVO?0:scope.row.warehouseInInfoVO.weight}}kg</span> <span style="margin-left: 10px;">{{$t('重量')}}:{{!scope.row.warehouseInInfoVO?0:scope.row.warehouseInInfoVO.weight}}kg</span>
<span style="margin-left: 10px;">{{$t('数量(个)')}}:{{!scope.row.warehouseInInfoVO?0:scope.row.warehouseInInfoVO.quantityAll}}</span>
</el-row> </el-row>
<el-row v-if="!scope.row.warehouseInInfoVO"> <el-row v-if="!scope.row.warehouseInInfoVO">
<span>{{$t('暂时没有入仓信息')}}</span> <span>{{$t('暂时没有入仓信息')}}</span>
...@@ -163,10 +164,8 @@ ...@@ -163,10 +164,8 @@
<el-table-column :label="$t('入仓体积')" align="center" > <el-table-column :label="$t('入仓体积')" align="center" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.volume" @change="updateField(scope.row, 'volume')" size="mini" disabled> {{scope.row.volume}}
<span slot="append"></span> </template>
</el-input>
</template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('收费体积')" align="center" > <el-table-column :label="$t('收费体积')" align="center" >
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -177,10 +176,8 @@ ...@@ -177,10 +176,8 @@
</el-table-column> </el-table-column>
<el-table-column :label="$t('入仓重量')" align="center"> <el-table-column :label="$t('入仓重量')" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.weight" @change="updateField(scope.row, 'weight')" size="mini" disabled> {{scope.row.weight}}kg
<span slot="append">kg</span> </template>
</el-input>
</template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('收费重量')" align="center"> <el-table-column :label="$t('收费重量')" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
...@@ -196,11 +193,8 @@ ...@@ -196,11 +193,8 @@
</el-input> </el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column :label="$t('箱数')" align="center"> <el-table-column :label="$t('箱数')" align="center" prop="num"></el-table-column>
<template slot-scope="scope"> <el-table-column :label="$t('数量(个)')" align="center" prop="quantity"></el-table-column>
<el-button type="text" @click="showWarehouse(scope.row)">{{scope.row.num}}</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('操作')" align="center"> <el-table-column :label="$t('操作')" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-delete" @click="removeShop(scope.row.id)">{{$t('移出')}}</el-button> <el-button size="mini" type="text" icon="el-icon-delete" @click="removeShop(scope.row.id)">{{$t('移出')}}</el-button>
...@@ -537,7 +531,7 @@ export default { ...@@ -537,7 +531,7 @@ export default {
page:1, page:1,
rows:20 rows:20
}, },
splitItemIndex:0, // splitItemIndex:0,
quantitySum:0, quantitySum:0,
// 当前查看的入仓记录 // 当前查看的入仓记录
currentWarehouseRecord: null, currentWarehouseRecord: null,
...@@ -597,7 +591,16 @@ export default { ...@@ -597,7 +591,16 @@ export default {
}, },
// 切换品名需要重置已放入的记录 // 切换品名需要重置已放入的记录
'shopForm.orderItemId'(){ 'shopForm.orderItemId'(){
this.shopForm.specsRecordVOList = [] // 默认取以前放入的品名
let split = this.splitData.find(item => item.id == this.splitData[this.splitIndex].id)
this.shopForm.specsRecordVOList = []
if(split) {
let specsRecordVOList = split.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId)?.specsRecordVOList || []
specsRecordVOList.forEach(item => {
const [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*')
this.shopForm.specsRecordVOList.push({...item, boxGauge1, boxGauge2, boxGauge3})
})
}
} }
}, },
computed:{ computed:{
...@@ -614,8 +617,8 @@ export default { ...@@ -614,8 +617,8 @@ export default {
}, },
// 主单数据,也就是拆分剩余的数据,可用来限制拆单放入的最大值 // 主单数据,也就是拆分剩余的数据,可用来限制拆单放入的最大值
mainOrderItem(){ mainOrderItem(){
if(!this.orderItem.orderItemId || !this.splitData.length || !this.splitData[0].orderSplitItemBackVOList) return {} if(!this.shopForm.orderItemId) return {}
return this.splitData[0].orderSplitItemBackVOList.find(item => item.orderItemId == this.orderItem.orderItemId) || {} return this.orderData.orderItemVOList.find(item => item.orderItemId === this.shopForm.orderItemId)
}, },
// 剩余可拆数据,父订单的入仓数据 - 全部拆单的品名数据 // 剩余可拆数据,父订单的入仓数据 - 全部拆单的品名数据
leftData(){ leftData(){
...@@ -634,6 +637,11 @@ export default { ...@@ -634,6 +637,11 @@ export default {
this.splitData.forEach(split => { this.splitData.forEach(split => {
split.orderSplitItemBackVOList.forEach(splitItem => { split.orderSplitItemBackVOList.forEach(splitItem => {
// 正在拆的要排除,不然会重复计算
if(splitItem.orderItemId == this.shopForm.orderItemId && split.id == this.splitData[this.splitIndex].id){
return
}
// 每个品名的入仓记录挨个累减其他数据 // 每个品名的入仓记录挨个累减其他数据
if(splitItem.orderItemId == this.shopForm.orderItemId){ if(splitItem.orderItemId == this.shopForm.orderItemId){
// 每个品名都要累减收费数据 // 每个品名都要累减收费数据
...@@ -718,8 +726,12 @@ export default { ...@@ -718,8 +726,12 @@ export default {
return warehouseInId => { return warehouseInId => {
let specsRecordVOList = [] let specsRecordVOList = []
// 这里是全部已放入的 // 这里是全部已放入的
this.splitData.forEach(split => { this.splitData.forEach((split, splitIndex) => {
split.orderSplitItemBackVOList.forEach(splitItem => { split.orderSplitItemBackVOList.forEach(splitItem => {
// 当前正在拆的品名不包含,因为后面shopForm.specsRecordVOList会包含
if(splitIndex == this.splitIndex && splitItem.orderItemId == this.shopForm.orderItemId){
return
}
splitItem.specsRecordVOList && splitItem.specsRecordVOList.forEach(specs => { splitItem.specsRecordVOList && splitItem.specsRecordVOList.forEach(specs => {
if(specs.warehouseInId === warehouseInId){ if(specs.warehouseInId === warehouseInId){
specsRecordVOList.push(specs) specsRecordVOList.push(specs)
...@@ -869,7 +881,7 @@ export default { ...@@ -869,7 +881,7 @@ export default {
}) })
}, },
addShop(index){ addShop(index){
this.splitItemIndex = index this.splitIndex = index
this.shopOpen = true this.shopOpen = true
// 重置表单数据 // 重置表单数据
this.shopForm = {specsRecordVOList:[]} this.shopForm = {specsRecordVOList:[]}
...@@ -972,7 +984,7 @@ export default { ...@@ -972,7 +984,7 @@ export default {
var params = { var params = {
num:this.putin.num, num:this.putin.num,
orderItemId:this.shopForm.orderItemId, orderItemId:this.shopForm.orderItemId,
orderSplitId:this.splitData[this.splitItemIndex].id, orderSplitId:this.splitData[this.splitIndex].id,
remark:this.shopForm.remark, remark:this.shopForm.remark,
volume: this.putin.volume, volume: this.putin.volume,
chargeVolume: this.shopForm.chargeVolume, chargeVolume: this.shopForm.chargeVolume,
......
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