Commit a8017b08 authored by dragondean@qq.com's avatar dragondean@qq.com

拆单没搞完,提交备份一下

parent 08831f99
......@@ -154,14 +154,32 @@
<dict-tag :type="DICT_TYPE.ECW_IS_BRAND" :value="scope.row.brandType" />
</template>
</el-table-column>
<el-table-column :label="$t('体积')" align="center" >
<el-table-column :label="$t('入仓体积')" align="center" >
<template slot-scope="scope">
<span>{{scope.row.volume}}</span>
<el-input v-model="scope.row.volume" @change="updateField(scope.row, 'volume')" size="mini">
<span slot="append"></span>
</el-input>
</template>
</el-table-column>
<el-table-column :label="$t('重量')" align="center">
<el-table-column :label="$t('收费体积')" align="center" >
<template slot-scope="scope">
<span>{{scope.row.weight}}kg</span>
<el-input v-model="scope.row.chargeVolume" @change="updateField(scope.row, 'chargeVolume')" size="mini">
<span slot="append"></span>
</el-input>
</template>
</el-table-column>
<el-table-column :label="$t('入仓重量')" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.weight" @change="updateField(scope.row, 'weight')" size="mini">
<span slot="append">kg</span>
</el-input>
</template>
</el-table-column>
<el-table-column :label="$t('收费重量')" align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.chargeWeight" @change="updateField(scope.row, 'chargeWeight')" size="mini">
<span slot="append">kg</span>
</el-input>
</template>
</el-table-column>
<el-table-column :label="$t('箱数')" align="center">
......@@ -213,32 +231,42 @@
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="$t('放入品名')" :visible.sync="shopOpen" width="500px" append-to-body>
<el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="120px">
<el-row>
<el-form-item :label="$t('中文品名')+':'" v-if="splitData.length>0">
<el-form-item :label="$t('中文品名')" v-if="splitData.length>0">
<el-select v-model="shopForm.pordid" :placeholder="$t('请选择中文品名')" @change="changeProdTitleZh" clearable>
<el-option v-for="item in splitData[0].orderSplitItemBackVOList" :label="item.prodTitleZh" :value="item.id" :key="item.prodTitleZh" ></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item :label="$t('英文品名')+':'" v-if="splitData.length>0">
<el-form-item :label="$t('英文品名')" v-if="splitData.length>0">
<el-select v-model="shopForm.pordid" :placeholder="$t('请选择英文品名')" @change="changeProdTitleZh" clearable>
<el-option v-for="item in splitData[0].orderSplitItemBackVOList" :label="item.prodTitleEn" :value="item.id" :key="item.prodTitleEn" ></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('剩余箱数')+':'">
<el-form-item :label="$t('剩余箱数')">
{{shopForm.sum||0}}
</el-form-item>
<el-form-item :label="$t('放入箱数')+':'">
<el-form-item :label="$t('放入箱数')">
<el-input-number v-model="shopForm.num" @change="numChange" controls-position="right" :min="1" :max="shopForm.sum"></el-input-number>
</el-form-item>
<el-form-item v-if="quantityshow" :label="$t('放入数量')+'('+$t('个')+')'+':'">
<el-form-item v-if="quantityshow" :label="$t('放入数量')+'('+$t('个')+')'">
<el-input-number v-model="shopForm.quantity" controls-position="right" :min="1" :max="quantitySum"></el-input-number>
</el-form-item>
<el-form-item :label="$t('入仓体积')">
<el-input-number v-model="shopForm.volume" @change="numChange" controls-position="right" :min="1" :max="shopForm.sum"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费体积')">
<el-input-number v-model="shopForm.chargeVolume" @change="numChange" controls-position="right" :min="1" :max="shopForm.sum"></el-input-number>
</el-form-item>
<el-form-item :label="$t('入仓重量')">
<el-input-number v-model="shopForm.weight" @change="numChange" controls-position="right" :min="1" :max="shopForm.sum"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费重量')">
<el-input-number v-model="shopForm.chargeWeight" @change="numChange" controls-position="right" :min="1" :max="shopForm.sum"></el-input-number>
</el-form-item>
<el-form-item :label="$t('备注信息')+':'">
<el-input v-model="shopForm.remark"></el-input>
</el-form-item>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="shopAdd">{{$t('确定')}}</el-button>
......@@ -270,7 +298,7 @@ import {getWarehouseList} from '@/api/ecw/warehouse'
import {getChannelList} from '@/api/ecw/channel'
import WorkFlow from '@/components/WorkFlow'
import {getOrder} from '@/api/ecw/order'
import Decimal from 'decimal.js'
export default {
name: "SplitApply",
......@@ -364,6 +392,19 @@ export default {
}
},
methods: {
/*检查并提交字段(体积,重量)修改*/
updateField(row, field){
let val = parseFloat(row[field])
if(!val || val < 0){
this.$message.error(this.$t('数据无效'))
return this.getList()
}
createSplitItem(row).then(() => {
this.$message.success(this.$t('修改成功'))
}).catch(() => {
this.getList()
})
},
checkCode(data){
if(data.indexOf('+')==-1){
return '+'+data
......@@ -452,6 +493,37 @@ export default {
this.$modal.msgError(this.$t("请先新建拆单"))
return
}
// 判断体积和重量,子单和必须等于父单
// 1.将拆单中的商品项数据汇总保存到orderItem
this.splitData.forEach(item => {
item.orderSplitItemBackVOList.forEach(splitItem => {
let orderItem = this.orderData.orderItemVOList.find(orderItem => orderItem.orderItemId == splitItem.orderItemId)
if(!orderItem.splitSum){
orderItem.splitSum = {
volume: new Decimal(splitItem.volume || 0),
weight: new Decimal(splitItem.weight|| 0)
}
}else{
orderItem.splitSum.volume = orderItem.splitSum.volume.plus(splitItem.volume || 0)
orderItem.splitSum.weight = orderItem.splitSum.weight.plus(splitItem.weight || 0)
}
})
})
// 2. 遍历商品项 对比数据是否符合
let prods = [] // 数据不符合要求的商品
this.orderData.orderItemVOList.forEach(item => {
if(!item.splitSum){
prods.push(this.$l(item, 'prodTitle'))
return
}
if(item.splitSum.volume.toNumber() != item.warehouseInInfoVO.volume || item.splitSum.weight.toNumber() != item.warehouseInInfoVO.weight){
prods.push(this.$l(item, 'prodTitle'))
}
})
if(prods.length){
return this.$alert( this.$t("{prods}等商品拆单总数据跟主单不匹配", {prods: prods.join(',')}))
}
// if(this.selectedUsers.length==0){
// this.$modal.msgError("请选择抄送人")
// return
......@@ -468,7 +540,6 @@ export default {
addShop(index){
this.splitItemIndex = index
this.shopOpen = true
},
addSplit(){
this.form.transportId = this.orderData.transportId
......@@ -552,7 +623,11 @@ export default {
num:this.shopForm.num,
orderItemId:this.shopForm.orderItemId,
orderSplitId:this.splitData[this.splitItemIndex].id,
remark:this.shopForm.remark
remark:this.shopForm.remark,
volume: this.shopForm.volume,
chargeVolume: this.shopForm.chargeVolume,
weight: this.shopForm.weight,
chargeWeight: this.shopForm.chargeWeight
}
createSplitItem(params).then(res=>{
this.$message.success(this.$t("放入成功"));
......
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