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

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

parent 08831f99
......@@ -154,16 +154,34 @@
<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>
</template>
<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">
<template slot-scope="scope">
<span>{{scope.row.num}}</span>
......@@ -186,80 +204,90 @@
<el-button v-if="orderData.inWarehouseState==207" plain type="primary" @click="dialogVisible = true">{{$t('取消审核')}}</el-button>
<el-button v-if="orderData.inWarehouseState==207" plain type="primary" @click="$store.dispatch('tagsView/delCurrentView')">{{$t('返回')}}</el-button>
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="$t('新建拆单')" :visible.sync="open" width="400px" append-to-body>
<el-form ref="formSplit" :model="form" :rules="rules" label-width="80px">
<el-form-item :label="$t('运输方式')">
<dict-selector :clearable="true" :type="DICT_TYPE.ECW_TRANSPORT_TYPE" @change="changeTransport" v-model="form.transportId" />
</el-form-item>
<el-form-item :label="$t('出货渠道')" v-if="getDictData(DICT_TYPE.ECW_TRANSPORT_TYPE, form.transportId).cssClass == 'channel'">
<el-select v-model="form.channelId" :placeholder="$t('请选择出货渠道')" :clearable="true">
<el-option :disabled="getDictData(DICT_TYPE.ECW_TRANSPORT_TYPE, form.transportId).cssClass != 'channel'" v-for="item in channelData" :key="item.channelId" :label="$l(item, 'name')" :value="item.channelId"/>
</el-select>
</el-form-item>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="$t('新建拆单')" :visible.sync="open" width="400px" append-to-body>
<el-form ref="formSplit" :model="form" :rules="rules" label-width="80px">
<el-form-item :label="$t('运输方式')">
<dict-selector :clearable="true" :type="DICT_TYPE.ECW_TRANSPORT_TYPE" @change="changeTransport" v-model="form.transportId" />
</el-form-item>
<el-form-item :label="$t('出货渠道')" v-if="getDictData(DICT_TYPE.ECW_TRANSPORT_TYPE, form.transportId).cssClass == 'channel'">
<el-select v-model="form.channelId" :placeholder="$t('请选择出货渠道')" :clearable="true">
<el-option :disabled="getDictData(DICT_TYPE.ECW_TRANSPORT_TYPE, form.transportId).cssClass != 'channel'" v-for="item in channelData" :key="item.channelId" :label="$l(item, 'name')" :value="item.channelId"/>
</el-select>
</el-form-item>
<el-form-item :label="$t('目的仓库')" >
<el-select v-model="form.destWarehouseId" @change="changeDeatWarehouseId" :placeholder="$t('请选择目的仓库')" :clearable="true">
<el-option v-for="items in importCityList" :label="$l(items, 'title')" :value="items.id" :key="items.id" ></el-option>
</el-select>
</el-form-item>
</el-form>
<el-form-item :label="$t('目的仓库')" >
<el-select v-model="form.destWarehouseId" @change="changeDeatWarehouseId" :placeholder="$t('请选择目的仓库')" :clearable="true">
<el-option v-for="items in importCityList" :label="$l(items, 'title')" :value="items.id" :key="items.id" ></el-option>
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="haddleAdd">{{$t('确定')}}</el-button>
<el-button @click="cancel">{{$t('取消')}}</el-button>
</div>
</el-dialog>
<!-- 对话框(添加 / 修改) -->
<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-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-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('剩余箱数')+':'">
{{shopForm.sum||0}}
</el-form-item>
<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-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 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>
<el-button @click="shopCancel">{{$t('取消')}}</el-button>
</div>
</el-dialog>
<el-dialog
:title="$t('提示')"
:visible.sync="dialogVisible"
width="30%">
<span class="cancel_notice">{{$t('拆单申请正在审核中,你确定取消拆单申请吗?')}}</span>
<div class="cancel_content">
<span>{{$t('取消原因:')}}</span>
<el-input v-model="reason" :placeholder="$t('请输入取消原因')"></el-input>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="haddleAdd">{{$t('确定')}}</el-button>
<el-button @click="cancel">{{$t('取消')}}</el-button>
</div>
</el-dialog>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="$t('放入品名')" :visible.sync="shopOpen" width="500px" append-to-body>
<el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="120px">
<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-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('剩余箱数')">
{{shopForm.sum||0}}
</el-form-item>
<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-input-number v-model="shopForm.quantity" controls-position="right" :min="1" :max="quantitySum"></el-input-number>
</el-form-item>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">{{$t('取消')}}</el-button>
<el-button type="primary" @click="cancelSplit">{{$t('确定')}}</el-button>
</span>
</el-dialog>
<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-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="shopAdd">{{$t('确定')}}</el-button>
<el-button @click="shopCancel">{{$t('取消')}}</el-button>
</div>
</el-dialog>
<el-dialog
:title="$t('提示')"
:visible.sync="dialogVisible"
width="30%">
<span class="cancel_notice">{{$t('拆单申请正在审核中,你确定取消拆单申请吗?')}}</span>
<div class="cancel_content">
<span>{{$t('取消原因:')}}</span>
<el-input v-model="reason" :placeholder="$t('请输入取消原因')"></el-input>
</div>
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false">{{$t('取消')}}</el-button>
<el-button type="primary" @click="cancelSplit">{{$t('确定')}}</el-button>
</span>
</el-dialog>
</div>
</template>
......@@ -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