Commit 396aafdf authored by dragondean@qq.com's avatar dragondean@qq.com

拆单的bug

parent 74cd1ba9
......@@ -225,7 +225,7 @@
<div class="page-title">{{$t('品名可拆数据')}}</div>
<div class="pl-20">
<span class="mr-10">{{$t('箱数')}}:{{ mainOrderItem.num || 0 }}</span>
<span class="mr-10">{{$t('箱数')}}:{{ Math.min(mainOrderItem.num, maxNum) || 0 }}</span>
<span class="mr-10">{{ $t('入仓方数') }}:{{ mainOrderItem.volume || 0 }}m³</span>
<span class="mr-10">{{ $t('收费方数') }}:{{ mainOrderItem.chargeVolume || 0 }}m³</span>
<span class="mr-10">{{ $t('入仓重量') }}:{{ mainOrderItem.weight || 0 }}kg</span>
......@@ -239,7 +239,7 @@
style="width: 100%">
<el-table-column :label="$t('箱数')">
<template v-slot="{row,$index}">
{{getWarehouseLeftData(row, 'num')}}
{{Math.min(getWarehouseLeftData(row, 'num'), maxNum)}}
<dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" v-model="row.specificationType"></dict-tag>
</template>
</el-table-column>
......@@ -385,6 +385,7 @@
@close="currentPutIn=null"
@submit="handlePutin"
:warehouse-id="currentWarehouseId"
:maxNum="maxNum"
append-to-body
></put-in>
</div>
......@@ -632,6 +633,10 @@ export default {
})
return total.toNumber()
}
},
// 最大可装箱数 原单箱数 - 已装箱数
maxNum(){
return this.currRow.num - this.currRow.installNum
}
},
methods: {
......
......@@ -5,7 +5,7 @@
<div slot="header">{{$t('可拆出入仓记录')}}</div>
<el-table :data="[warehouseRecord]">
<el-table-column :label="$t('箱数')" prop="cartonsNum">
<template slot-scope="{row}">{{row.cartonsNum}}</template>
<template slot-scope="{row}">{{Math.min(row.cartonsNum, maxNum)}}</template>
</el-table-column>
<el-table-column :label="$t('入仓类型')" prop="specificationType">
<template slot-scope="{row}">
......@@ -46,8 +46,8 @@
</el-table-column>
</el-table>
<div>
{{$t('剩余')}}:
{{leftData('num')}}{{$t('箱')}},
{{$t('可拆')}}:
{{maxSplitNum}}{{$t('箱')}},
{{$t('体积')}}:{{leftData('volume')}}{{$t('m³')}},
{{$t('重量')}}:{{leftData('weight')}}{{$t('kg')}},
{{$t('数量')}}:{{leftData('quantity')}}{{$t('个')}}
......@@ -71,7 +71,9 @@
<el-form-item class="flex" label-width="0"
:prop="`list.${$index}.num`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-75 tight" v-model="row.num" :max="warehouseRecord.cartonsNum" @change="calc(row)"></el-input-number>
<!--需求方要求输入后马上计算其他数据,el组件无法绑定keyup事件,所以用原生的input-->
<!--<el-input-number controls-position="right" :min="0" class="w-75 tight" v-model="row.num" :max="warehouseRecord.cartonsNum" @keyup.native="calc(row)"></el-input-number>-->
<input class="input" v-model="row.num" type="number" @keyup="calc(row)" :min="0" :max="maxSplitNum"></input>
<dict-selector class="w-75" :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" v-model="row.specificationType" defaultable></dict-selector>
</el-form-item>
</template>
......@@ -217,7 +219,7 @@ import {parseTime} from '@/utils/ruoyi'
import Decimal from 'decimal.js'
import Template from "@/views/cms/template/index.vue";
export default {
name: "WarehouseRecord",
name: "Putin",
filters:{parseTime},
components: {Template, WarehouseAreaSelect},
props:{
......@@ -226,7 +228,9 @@ export default {
// 仓库ID,选择储位要用到
warehouseId: Number,
// 数量是否必须
quantityshow: Boolean
quantityshow: Boolean,
// 最大可拆箱数,装柜拆单用
maxNum: Number
},
data(){
return {
......@@ -272,6 +276,10 @@ export default {
return left.toNumber()
}
},
// 可拆箱数
maxSplitNum(){
return Math.min(this.maxNum, this.leftData('num'))
}
},
mounted() {
......@@ -282,14 +290,13 @@ export default {
// 添加一行
addRow(){
let { specificationType, boxGauge1, boxGauge2, boxGauge3, volume, weight, expressNo } = this.warehouseRecord
let num = this.warehouseRecord.cartonsNum
// 根据入仓记录添加一行
this.form.list.push({
warehouseInId: this.warehouseRecord.id,
specificationType, boxGauge1, boxGauge2, boxGauge3, expressNo,
volume: this.leftData('volume', true),
weight: this.leftData('weight', true),
num: this.leftData('num', true),
num: Math.min(this.leftData('num', true), this.maxSplitNum),
quantity: this.leftData('quantity', true),
orderLocationList: this.warehouseRecord.orderLocationBackVOList
})
......@@ -327,7 +334,7 @@ export default {
const rate = row.num / this.warehouseRecord.cartonsNum
row.volume = (this.warehouseRecord.volume * rate).toFixed(2)
row.weight = (this.warehouseRecord.weight * rate).toFixed(2)
row.quantity = (this.warehouseRecord.quantityAll * rate).toFixed(2)
row.quantity = (this.warehouseRecord.quantityAll * rate).toFixed(0)
},
closeDialog(){
this.show = false
......@@ -339,8 +346,8 @@ export default {
return false
}
if(this.splitTotal('num') > this.leftData('num')){
return this.$message.error("拆出箱数不能大于剩余箱数")
if(this.splitTotal('num') > this.maxSplitNum){
return this.$message.error("拆出箱数不能大于可拆箱数")
}
if(this.splitTotal('volume') > this.leftData('volume')){
return this.$message.error("拆出体积不能大于剩余体积")
......@@ -366,5 +373,11 @@ export default {
</script>
<style scoped>
.input{
border: 1px solid #DCDFE6;
padding: 5px 6px;
border-radius: 5px;
}
</style>
......@@ -163,35 +163,35 @@
<el-table-column :label="$t('入仓体积')" align="center" >
<template slot-scope="scope">
<el-input v-model="scope.row.volume" @change="updateField(scope.row, 'volume')" size="mini" :disabled="index === 0">
<el-input v-model="scope.row.volume" @change="updateField(scope.row, 'volume')" size="mini" disabled>
<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.chargeVolume" @change="updateField(scope.row, 'chargeVolume')" size="mini" :disabled="index === 0">
<el-input v-model="scope.row.chargeVolume" @change="updateField(scope.row, 'chargeVolume')" size="mini" disabled>
<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" :disabled="index === 0">
<el-input v-model="scope.row.weight" @change="updateField(scope.row, 'weight')" size="mini" disabled>
<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" :disabled="index === 0">
<el-input v-model="scope.row.chargeWeight" @change="updateField(scope.row, 'chargeWeight')" size="mini" disabled>
<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.worth" @change="updateField(scope.row, 'worth')" size="mini" :disabled="index === 0">
<el-input v-model="scope.row.worth" @change="updateField(scope.row, 'worth')" size="mini" disabled>
<span slot="append">{{ $t('') }}</span>
</el-input>
</template>
......@@ -211,11 +211,16 @@
</el-card>
<work-flow xmlkey="split_order" v-model="selectedUsers"></work-flow>
<div slot="footer" class="card footer_btn" v-if="orderData.abnormalState==0">
<el-button v-if="orderData.inWarehouseState!=207" type="primary" @click="submitForm">{{$t('提交申请')}}</el-button>
<el-button v-if="orderData.inWarehouseState!=207" plain type="primary" @click="$store.dispatch('tagsView/delCurrentView')">{{$t('取消')}}</el-button>
<el-button v-if="orderData.inWarehouseState==207" type="primary" @click="$router.push(`/bpm/process-instance/detail?id=`+orderApprovalBackVO.applyingFormId)">{{$t('审核中')}}</el-button>
<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>
<template v-if="orderData.inWarehouseState!=207">
<el-button type="primary" @click="submitForm">{{$t('提交申请')}}</el-button>
<el-button plain type="primary" @click="$store.dispatch('tagsView/delCurrentView')">{{$t('取消')}}</el-button>
<el-button type="primary" @click="reset">{{$t('重置')}}</el-button>
</template>
<template v-else>
<el-button type="primary" @click="$router.push(`/bpm/process-instance/detail?id=`+orderApprovalBackVO.applyingFormId)">{{$t('审核中')}}</el-button>
<el-button plain type="primary" @click="dialogVisible = true">{{$t('取消审核')}}</el-button>
<el-button plain type="primary" @click="$store.dispatch('tagsView/delCurrentView')">{{$t('返回')}}</el-button>
</template>
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="$t('新建拆单')" :visible.sync="open" width="400px" append-to-body>
......@@ -440,13 +445,14 @@
</span>
</el-dialog>
<warehouse-record v-if="currentWarehouseRecord" :list="currentWarehouseRecord"></warehouse-record>
<warehouse-record v-if="currentWarehouseRecord" :list="currentWarehouseRecord" @close="currentWarehouseRecord=null"></warehouse-record>
<put-in
v-if="currentPutIn"
:warehouse-record="currentPutIn"
@close="currentPutIn=null"
@submit="handlePutin"
:warehouse-id="currentWarehouseId"
:max-num="orderData.sumNum"
></put-in>
</div>
</template>
......@@ -472,10 +478,12 @@ import WarehouseAreaSelect from "@/components/WarehouseAreaSelect";
import WarehouseDetail from "@/views/ecw/order/components/WarehouseDetail";
import WarehouseRecord from "@/views/ecw/order/splitApply/components/WarehouseRecord";
import PutIn from "@/views/ecw/order/splitApply/components/PutIn.vue";
import Template from "@/views/cms/template/index.vue";
export default {
name: "SplitApply",
components: {
Template,
WarehouseRecord,
WarehouseDetail,
WarehouseAreaSelect,
......@@ -549,16 +557,7 @@ 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){
// 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("重置成功")
})*/
this.reset()
}
})
// 获取入仓记录
......@@ -855,47 +854,6 @@ export default {
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 = [] // 数据不符合要求的商品
// 挂在到window测试
window.orderData = this.orderData
this.orderData.orderItemVOList.forEach(item => {
// 未入仓的不检查
if(!item.warehouseInInfoVO){
return
}
// 没拆单的不检查
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
// }
var params = {
orderId:this.queryParams.orderId,
copyUserId:this.selectedUsers
......@@ -1144,6 +1102,12 @@ export default {
this.$confirm(this.$t("确定要清空放入数据么?")).then(res => {
this.shopForm.specsRecordVOList = []
})
},
// 重置
reset(){
deleteAllSplit(this.queryParams.orderId).then(res => {
this.getList()
})
}
}
}
......
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