Commit 6eeba1a0 authored by 我在何方's avatar 我在何方

Merge branch 'release' of http://gitlab.jdshangmen.com/jiedao-app/jiedao-app-operator into release

parents da6698b3 fb01fe3b
......@@ -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;
......
......@@ -48,7 +48,9 @@ export function getCustomerPage(query) {
return request({
url: '/ecw/customer/page',
method: 'get',
params: query
params: query,
timeout: 60000
})
}
/**
......
......@@ -25,7 +25,8 @@ export function getCustomerPage(query) {
return request({
url: '/ecw/indirect-customer/page',
method: 'get',
params: query
params: query,
timeout: 30000
})
}
......
......@@ -79,8 +79,10 @@ export default {
if(index < 0){
getProduct(this.value).then(res => {
this.list.unshift(res.data)
this.$nextTick(() => {
this.index = 0
})
})
}else this.index = index
},
onFocus(){
......
......@@ -142,7 +142,8 @@ export default {
if (f.selected) result.push({
orderId: this.orderId,
wareId: f.pid,
areaId: f.id
areaId: f.id,
locationName: f.code
})
else {
f.positionList?.forEach(g => {
......@@ -151,7 +152,8 @@ export default {
orderId: this.orderId,
wareId: g.domainId,
areaId: g.areaId,
locationId: g.id
locationId: g.id,
locationName: f.code + g.code
})
else g.children?.forEach(k => {
// 子位置
......@@ -159,7 +161,8 @@ export default {
orderId: this.orderId,
wareId: k.domainId,
areaId: k.areaId,
locationId: k.id
locationId: k.id,
locationName: f.code + k.code
})
})
})
......
......@@ -281,6 +281,11 @@ export default {
component: "BoxSplitDetail",
id: this.processInstance.businessKey,
},
// 退场拆单,跟出货装柜拆单一样
customs_exit_part_split: {
component: "BoxSplitDetail",
id: this.processInstance.businessKey,
},
merge_detail: {
component: "MergeDetail",
id: this.processInstance.businessKey,
......
......@@ -211,207 +211,169 @@
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="$t('放入品名')" :visible.sync="shopOpen" width="1500px" append-to-body>
<el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="150px" size="mini">
<el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="150px" inline>
<el-form-item :label="$t('中文品名')+':'" prop="orderItemId">
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择中文品名')" @change="onProdChange">
<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-select>
</el-form-item>
<el-form-item :label="$t('英文品名')+':'" prop="orderItemId">
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择英文品名')" @change="onProdChange">
<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-select>
</el-form-item>
<el-form-item :label="$t('剩余数据')">
<div>{{$t('剩余箱数')}}{{ shopForm.sum || 0 }}</div>
<div>
{{ $t('入仓方数') }}:{{ mainOrderItem.volume || 0 }}m³
{{ $t('收费方数') }}:{{ mainOrderItem.chargeVolume || 0 }}m³
</div>
<div>
{{ $t('入仓重量') }}:{{ mainOrderItem.weight || 0 }}kg
{{ $t('收费重量') }}:{{ mainOrderItem.chargeWeight || 0 }}kg
</div>
<div>
{{ $t('数量(个)') }}:{{ mainOrderItem.quantity || 0 }}
{{ $t('剩余货值') }}:{{ mainOrderItem.worth || 0 }}{{ $t('元') }}
</div>
</el-form-item>
<el-card class="box-card" v-if="shopForm.specsRecordVOList">
<div slot="header" class="clearfix">
<span>{{ $t('入仓记录') }}</span>
<el-button style="float: right;margin-left: 15px" size="mini" type="primary" icon="el-icon-minus" circle @click="deleteRow" :disabled="shopForm.specsRecordVOList.length <= 1"></el-button>
<el-button style="float: right" size="mini" type="primary" icon="el-icon-plus" circle @click="addRow" :disabled="!shopForm.orderItemId"></el-button>
<div class="page-title">{{$t('品名可拆数据')}}</div>
<div class="pl-20">
<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>
<span class="mr-10">{{ $t('收费重量') }}:{{ mainOrderItem.chargeWeight || 0 }}kg</span>
<span class="mr-10">{{ $t('数量(个)') }}:{{ mainOrderItem.quantity || 0 }}</span>
<span class="mr-10">{{ $t('剩余货值') }}:{{ mainOrderItem.worth || 0 }}{{ $t('元') }}</span>
</div>
<div class="page-title">{{$t('可拆入仓记录')}}</div>
<el-table
:data="shopForm.specsRecordVOList"
:data="getOrderItemWarehouseIn(shopForm.orderItemId)"
style="width: 100%">
<el-table-column :label="$t('箱数')" width="200px">
<template v-slot:header>
<span style="color: red">*</span>{{ $t('箱数') }}
</template>
<el-table-column :label="$t('箱数')">
<template v-slot="{row,$index}">
<el-form-item class="flex" label-width="0"
:prop="`specsRecordVOList.${$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" type="number"></el-input-number>
<dict-selector class="w-75" :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" v-model="row.specificationType" defaultable></dict-selector>
</el-form-item>
{{Math.min(getWarehouseLeftData(row, 'num'), leftSplitNum)}}
<dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" v-model="row.specificationType"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('包装类型')" width="100px">
<template v-slot:header>
<span style="color: red">*</span>{{ $t('包装类型') }}
</template>
<el-table-column :label="$t('包装类型')">
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<dict-selector :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="row.unit" defaultable></dict-selector>
</el-form-item>
<dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="row.unit"></dict-tag>
</template>
</el-table-column>
<el-table-column label="长(cm)">
<template v-slot:header>
<span>{{ $t('') }}</span>(cm)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.boxGauge1" @blur="calcVolume(row)"/>
</el-form-item>
{{row.boxGauge1}}
</template>
</el-table-column>
<el-table-column label="宽(cm)">
<template v-slot:header>
<span>{{ $t('') }}</span>(cm)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.boxGauge2" @blur="calcVolume(row)" />
</el-form-item>
{{ row.boxGauge2 }}
</template>
</el-table-column>
<el-table-column label="高(cm)">
<template v-slot:header>
<span>{{ $t('') }}</span>(cm)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.boxGauge3" @blur="calcVolume(row)"/>
</el-form-item>
{{ row.boxGauge3 }}
</template>
</el-table-column>
<el-table-column label="入仓体积(m³)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('体积') }}</span>(m³)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`specsRecordVOList.${$index}.volume`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.volume"/>
</el-form-item>
{{getWarehouseLeftData(row, 'volume')}}
</template>
</el-table-column>
<el-table-column label="收费体积(m³)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('收费体积') }}</span>(m³)
<el-table-column label="入仓重量(Kg)" prop="weight">
<template v-slot="{row,$index}">
{{getWarehouseLeftData(row, 'weight')}}
</template>
</el-table-column>
<el-table-column :label="$t('数量')" prop="quantity">
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`specsRecordVOList.${$index}.chargeVolume`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.chargeVolume"/>
</el-form-item>
{{getWarehouseLeftData(row, 'quantity')}}
</template>
</el-table-column>
<el-table-column :label="$t('快递单号')" prop="expressNo"></el-table-column>
<el-table-column :label="$t('储位')" prop="orderLocationBackVOList">
<template v-slot="{ row, column, $index }">
<warehouse-area-select
v-model="row.orderLocationBackVOList"
readonly
:warehouse-id="currentWarehouseId"
></warehouse-area-select>
</template>
</el-table-column>
<el-table-column label="入仓重量(Kg)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('入仓重量') }}</span>(Kg)
<el-table-column :label="$t('操作')">
<template v-slot="{ row, column, $index}">
<el-tag v-if="getWarehouseInSplitData(row.id,'num') >= row.cartonsNum" disabled size="mini" type="primary" >{{$t('已拆完')}}</el-tag>
<el-button v-else size="mini" type="primary" @click="putInRecord(row)" :disabled="leftSplitNum <= 0">放入</el-button>
</template>
</el-table-column>
</el-table>
<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%">
<el-table-column :label="$t('箱数')" width="200px">
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`specsRecordVOList.${$index}.weight`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.weight"/>
</el-form-item>
{{row.num}}
<dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" v-model="row.specificationType"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('包装类型')" width="100px">
<template v-slot="{row,$index}">
<dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="row.unit"></dict-tag>
</template>
</el-table-column>
<el-table-column label="收费重量(Kg)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('收费重量') }}</span>(Kg)
<el-table-column label="长(cm)">
<template v-slot="{row,$index}">
{{row.boxGauge1}}
</template>
</el-table-column>
<el-table-column label="宽(cm)">
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`specsRecordVOList.${$index}.chargeWeight`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.chargeWeight" type="number"/>
</el-form-item>
{{ row.boxGauge2 }}
</template>
</el-table-column>
<el-table-column :label="$t('数量')" width="130px">
<el-table-column label="高(cm)">
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`specsRecordVOList.${$index}.quantity`"
:rules="{required: isQuantity, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-75 tight" v-model.number="row.quantity" />{{ $t('') }}
</el-form-item>
{{ row.boxGauge3 }}
</template>
</el-table-column>
<el-table-column :label="$t('快递单号')">
<el-table-column label="入仓体积(m³)">
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input v-model="row.expressNo"></el-input>
</el-form-item>
{{row.volume}}
</template>
</el-table-column>
<!--<el-table-column label="收费体积(m³)" prop="chargeVolume"></el-table-column>-->
<el-table-column label="入仓重量(Kg)" prop="weight"></el-table-column>
<!--<el-table-column label="收费重量(Kg)" prop="chargeWeight"></el-table-column>-->
<el-table-column :label="$t('数量')" width="130px" prop="quantity"></el-table-column>
<el-table-column :label="$t('快递单号')" prop="expressNo"></el-table-column>
<el-table-column :label="$t('储位')" prop="orderLocationBackVOList">
<template v-slot="{ row, column, $index }">
<!--<el-button type="primary" size="mini" @click="showLocation(row, $index)">{{ $t('选择储位') }}</el-button>-->
<warehouse-area-select
v-model="row.orderLocationList"
:warehouse-id="splitData.dstWarehouseId"
></warehouse-area-select>
{{getLocationName(row.orderLocationList)}}
</template>
</el-table-column>
<el-table-column :label="$t('操作')">
<template v-slot="{ row, column, $index}">
<el-popconfirm
v-if="$index > 0"
:title="$t('确定要删除该行入仓记录吗?')"
@confirm="deleteRow($index)"
>
<template v-slot:reference>
<el-button size="mini" type="danger">删除</el-button>
</template>
</el-popconfirm>
<el-button size="mini" type="primary" @click="deleteRow($index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-form-item :label="$t('放入数据')">
<div>{{$t('箱数')}}{{ putin.num || 0 }}</div>
<div>
{{ $t('入仓方数') }}:{{ putin.volume || 0 }}m³
{{ $t('收费方数') }}:{{ putin.chargeVolume || 0 }}m³
</div>
<div>
{{ $t('入仓重量') }}:{{ putin.weight || 0 }}kg
{{ $t('收费重量') }}:{{ putin.chargeWeight || 0 }}kg
</div>
<div>
{{ $t('数量(个)') }}:{{ putin.quantity || 0 }}
<div class="page-title">放入数据</div>
<div class="pl-20 mb-10">
<span class="mr-10">{{$t('箱数')}}:{{ putin.num || 0 }},</span>
<span class="mr-10">{{ $t('数量(个)') }}:{{ putin.quantity || 0 }},</span>
<span class="mr-10">{{ $t('入仓方数') }}:{{ putin.volume || 0 }}m³, </span>
<span class="mr-10">{{ $t('入仓重量') }}:{{ putin.weight || 0 }}kg</span>
</div>
<el-form-item :label="$t('收费方数')" prop="chargeVolume">
<el-input-number v-model="shopForm.chargeVolume" controls-position="right"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费重量')" prop="chargeWeight">
<el-input-number v-model="shopForm.chargeWeight" controls-position="right"></el-input-number>kg
</el-form-item>
<el-form-item :label="$t('放入货值')">
<el-input-number v-model="shopForm.worth" controls-position="right" :min="0" :max="mainOrderItem.worth"></el-input-number>
<el-input-number v-model="shopForm.worth" controls-position="right" :min="0" :max="mainOrderItem.worth">
<template slot="append">{{ $t('') }}</template>
</el-input-number>
</el-form-item>
<!--按照原型这里需要显示剩余数量,但是事实无法计算剩余数量,因为已装数量是未知的-->
<!--<el-form-item :label="$t('放入数量(个)')+':'" prop="quantity" v-if="isQuantity">
<el-input-number v-model="shopForm.quantity" controls-position="right" :min="0" :max="mainOrderItem.quantity || undefined"></el-input-number>
</el-form-item>-->
<el-form-item :label="$t('备注信息')+':'">
<el-input v-model="shopForm.remarks"></el-input>
<el-form-item :label="$t('备注信息')">
<el-input v-model="shopForm.remark"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -421,6 +383,15 @@
</el-dialog>
<warehouse-record v-if="currentWarehouseRecord" :list="currentWarehouseRecord" append-to-body></warehouse-record>
<put-in
v-if="currentPutIn"
:warehouse-record="currentPutIn"
@close="currentPutIn=null"
@submit="handlePutin"
:warehouse-id="currentWarehouseId"
:maxNum="leftSplitNum"
append-to-body
></put-in>
</div>
</template>
......@@ -434,18 +405,20 @@ import {
import {quantityRequired} from "@/api/ecw/warehouse";
import { getTradeCityList } from "@/api/ecw/region";
import WorkFlow from "@/components/WorkFlow";
import {getOrder, splitItemUpdate} from "@/api/ecw/order";
import {getOrder, getOrderWarehouseIn, splitItemUpdate} from "@/api/ecw/order";
import { serviceMsg, toReviewDetail } from "../../utils";
import { createApproval, approvalCancel, splitList } from "@/api/ecw/boxSea";
import Decimal from "decimal.js";
import Warehouse from "@/views/ecw/order/warehousing/components/Warehouse";
import WarehouseRecord from "@/views/ecw/order/splitApply/components/WarehouseRecord";
import WarehouseAreaSelect from "@/components/WarehouseAreaSelect";
import PutIn from "@/views/ecw/order/splitApply/components/PutIn.vue";
export default {
name: "splitOrder",
inheritAttrs: false,
components: {
PutIn,
WarehouseAreaSelect,
WarehouseRecord,
Warehouse,
......@@ -493,7 +466,13 @@ export default {
// 主单数据
mainOrder: {orderSplitItemBackVOList: {}},
// 当前查看的入仓记录
currentWarehouseRecord: null
currentWarehouseRecord: null,
// 订单入仓记录
warehouseInList: [],
// 当前选择的入仓记录ID
selectedWarehouseInId: null,
// 当前正在放入的入仓记录
currentPutIn: null
};
},
created() {
......@@ -503,6 +482,11 @@ export default {
this.queryParams.orderId = this.currRow.orderId;
this.getOrderDetail();
this.getSplit();
// 获取入仓记录
getOrderWarehouseIn(this.queryParams.orderId).then(res => {
this.warehouseInList = res.data
})
},
watch: {
//监听table这个对象
......@@ -572,6 +556,106 @@ export default {
chargeWeight: data.chargeWeight.toNumber(),
quantity: data.quantity.toNumber()
}
},
// 当前仓库ID
currentWarehouseId(){
return this.orderData.adjustToDestWarehouseId || this.orderData.logisticsInfoDto.startWarehouseId
},
// 当前选择的入仓记录
/*currentWarehouseItem(){
return this.getOrderItemWarehouseIn(this.shopForm.orderItemId).find(item => item.id === this.selectedWarehouseInId)
},*/
// 根据orderItemId获取入仓记录
getOrderItemWarehouseIn() {
return orderItemId => {
const list = this.warehouseInList.find(item => item.orderItemId == orderItemId)?.orderWarehouseInBackItemDoList || []
return list.map(item => {
let [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*')
let labelArr = [
this.$t('{num}箱', {num: item.cartonsNum}),
this.$l(this.getDictDatas(this.DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE).find(dict => dict.value == item.specificationType), 'label'),
this.$t('长{boxGauge1}cm', {boxGauge1}),
this.$t('宽{boxGauge2}cm', {boxGauge2}),
this.$t('高{boxGauge3}cm', {boxGauge3}),
this.$t('方数{volume}m³', {volume: item.volume}),
this.$t('重量{weight}kg', {weight: item.weight})
]
if (item.quantityAll) {
labelArr.push(this.$t('数量{n}', {n: item.quantityAll}))
}
if (item.expressNo) {
labelArr.push(this.$t('快递{expressNo}', {expressNo: item.expressNo}))
}
if (item.orderLocationBackVOList && item.orderLocationBackVOList.length) {
labelArr.push(this.$t('储位{location}', {
location: item.orderLocationBackVOList.map(v => v.code || v.areaName + (v.locationName || '')).join(',')
}))
}
item.boxGauge1 = boxGauge1
item.boxGauge2 = boxGauge2
item.boxGauge3 = boxGauge3
item.text = labelArr.join(',')
return item
})
}
},
// 根据入仓记录ID筛选出他的全部拆出记录(不含主单的)
getWarehouseInspecsRecordVOList(){
return warehouseInId => {
let specsRecordVOList = []
// 这里是拆单已放入的
this.splitData.orderSplitItemBackVOList.forEach(splitItem => {
splitItem.specsRecordVOList.forEach(specs => {
if(specs.warehouseInId === warehouseInId){
specsRecordVOList.push(specs)
}
})
})
// 这里是正在操作放入,但是还没确定提交的
this.shopForm.specsRecordVOList.forEach(item => {
if(item.warehouseInId == warehouseInId)specsRecordVOList.push(item)
})
return specsRecordVOList
}
},
// 根据入仓ID获取拆出数据
getWarehouseInSplitData(){
return (warehouseInId, field) => {
let total = new Decimal(0)
this.getWarehouseInspecsRecordVOList(warehouseInId).forEach(item => {
total = total.plus(new Decimal(item[field] || 0))
})
return total.toNumber()
}
},
// 获取入仓记录的剩余数据
getWarehouseLeftData(){
return (warehouseRecord, field) => {
let warehouseField = field
if(field === 'num'){
warehouseField = 'cartonsNum'
}
if(field === 'quantity'){
warehouseField = 'quantityAll'
}
let total = new Decimal(warehouseRecord[ warehouseField ] || 0)
this.getWarehouseInspecsRecordVOList(warehouseRecord.id).forEach(item => {
total = total.minus(new Decimal(item[field] || 0))
})
return total.toNumber()
}
},
// 最大可装箱数 原单箱数 - 已装箱数
maxNum(){
return this.currRow.num - this.currRow.installNum
},
// 剩余可拆箱数
leftSplitNum(){
let num = this.maxNum - this.putin.num
this.splitData.orderSplitItemBackVOList.forEach(item =>{
num -= item.num
})
return num
}
},
methods: {
......@@ -713,60 +797,9 @@ export default {
this.shopForm = {};
this.shopOpen = true;
this.isQuantity = false;
// 重置表单数据
this.shopForm = {specsRecordVOList:[]}
},
// 更改放入品名后触发,计算重量体积等默认值
onProdChange(){
// 根据键值(中文名或者英文名)来获取对应商品的信息,注:这里应该可以采用orderItemId来获取更优,而不是商品名称,同名可能导致异常
let orderItem = this.orderData.orderItemVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
console.log({orderItem})
// 剩余可装箱数,订单入仓箱数 - 订单已装箱数 - 已拆箱数
let leftNum = Decimal(this.currRow.num).minus(this.currRow.installNum).minus(this.totalSplit('num'))
// 剩余箱数
this.$set(this.shopForm, 'leftNum', leftNum)
// 如果主单商品项的入仓箱数小于可装箱数,则取商品项数据
leftNum = Math.min(leftNum, this.mainOrderItem.num)
// 放入箱数
// this.$set(this.shopForm, 'num', leftNum)
// 默认给一个入仓记录
if(!this.shopForm.specsRecordVOList || !this.shopForm.specsRecordVOList.length){
this.addRow()
}
// this.calcAverg()
},
// 按比例计算体积重量的默认值
/*calcAverg(){
// 装箱比例
const rate = this.shopForm.num / this.mainOrderItem.num
// 放入个数,剩余个数是算不出来的,因为不知道已装数量,所以放入数量只能按照总数的比例计算
this.$set(this.shopForm, 'quantity', Math.ceil(this.mainOrderItem.quantity*rate|| 0 * rate))
// 数量,体积,重量等按照比例给默认值
this.$set(this.shopForm, 'volume', (this.mainOrderItem.volume * rate).toFixed(2))
this.$set(this.shopForm, 'chargeVolume', (this.mainOrderItem.chargeVolume * rate).toFixed(2))
this.$set(this.shopForm, 'weight', (this.mainOrderItem.weight * rate).toFixed(2))
this.$set(this.shopForm, 'chargeWeight', (this.mainOrderItem.chargeWeight * rate).toFixed(2))
this.$set(this.shopForm, 'worth', (this.mainOrderItem.worth * rate).toFixed(2))
},*/
/*async getSelectData(item) {
await quantityRequired(this.orderData.lineId).then((res) => {
if (res.data) {
this.isQuantity = true;
this.shopRules.putQuantity = [
{
required: true,
message: this.$t("请输入数量(个)"),
trigger: "change",
},
];
} else {
this.isQuantity = false;
delete this.shopRules.putQuantity;
}
});
},*/
shopAdd() {
this.$refs["shopForm"].validate((valid) => {
if (valid) {
......@@ -792,7 +825,8 @@ export default {
chargeWeight: this.putin.chargeWeight,
chargeVolume: this.putin.chargeVolume,
worth: this.shopForm.worth || 0,
specsRecordVOList:this.shopForm.specsRecordVOList
specsRecordVOList:this.shopForm.specsRecordVOList,
shipmentSplit: true
};
// 按数量计费的才需要传递数量
if(this.isQuantity){
......@@ -802,8 +836,8 @@ export default {
this.$message.success(this.$t("放入成功"));
this.querySplitGoods();
this.$refs["shopForm"].resetFields();
});
this.shopOpen = false;
});
}
});
},
......@@ -844,8 +878,15 @@ export default {
if(!this.shopForm.specsRecordVOList){
this.$set(this.shopForm,'specsRecordVOList',[])
}
if(!this.currentWarehouseItem){
return this.$message.info(this.$t("请选择入仓记录"))
}
let { specificationType, boxGauge1, boxGauge2, boxGauge3, volume, weight } = this.currentWarehouseItem
let num = this.currentWarehouseItem.cartonsNum
// 根据入仓记录添加一行
this.shopForm.specsRecordVOList.push({
orderLocationList: []
specificationType, boxGauge1, boxGauge2, boxGauge3, volume, weight,num,
orderLocationList: this.currentWarehouseItem.orderLocationBackVOList
})
},
// 删除一行,可选参数index表上行号,参数不是数字则删除最后一行
......@@ -874,6 +915,44 @@ export default {
return this.$message.info(this.$t('暂无入仓记录'))
}
this.currentWarehouseRecord = row.specsRecordVOList
},
// 获取储位名称
getLocationName(locationArr){
if(!locationArr || !locationArr.length) return ''
let arr = []
locationArr.forEach(item => {
arr.push(`${item.areaName}${item.locationName || ''}`)
})
return Array.from(new Set(arr)).join(",")
},
// 根据入仓记录打开放入弹层
putInRecord(row){
this.currentPutIn = row
// 此条入仓记录已拆出的入仓记录,这样在放入的时候可以确保不超过此入仓记录的数量
this.currentPutIn.specsRecordVOList = this.getWarehouseInspecsRecordVOList(row.id)
},
// 放入回调
handlePutin(list){
if(!list.length){
return this.$message.error(this.$t("请至少放入一条数据"))
}
list.forEach(item => {
this.shopForm.specsRecordVOList.push({...item})
})
this.currentPutIn = null
// 根据比例计算默认的收费方数和收费重量
const orderItem = this.orderData.orderItemVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
const rate = this.putin.num / orderItem.warehouseInInfoVO.cartonsNum
this.$set(this.shopForm, 'chargeVolume', (orderItem.chargeVolume*rate).toFixed(2))
this.$set(this.shopForm, 'chargeWeight', (orderItem.chargeWeight*rate).toFixed(2))
this.$set(this.shopForm, 'worth', (orderItem.worth*rate).toFixed(2))
},
// 清空放入记录
clearAll(){
this.$confirm(this.$t("确定要清空放入数据么?")).then(res => {
this.shopForm.specsRecordVOList = []
})
}
},
};
......
......@@ -279,6 +279,7 @@ export default {
secId: this.partData.id,
shipmentId: this.$attrs.shipmentObj.id,
orderId: item.orderId,
isCover: 1
};
if (type === "all") {
params.orderItemIdList = item.boxOrderItemList.map(
......
......@@ -563,14 +563,24 @@ export default {
const { columns, data } = param;
const sums = [];
columns.forEach((column, index) => {
if (column.property === "brandType") {
if (column.property === "feeType") {
sums[index] = this.$t("合计");
return;
}
if (column.property === "num") {
sums[index] = new Decimal(
this.calcSum(column.property, data)
).toNumber();
if (column.property === "warehouseInInfoVO.cartonsNum") {
var num = 0
let values = data?.map((item) => Number(item.warehouseInInfoVO.cartonsNum)) ?? [];
if (!values.every((value) => isNaN(value))) {
num = values.reduce((prev, curr) => {
const value = Number(curr);
if (!isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0);
}
sums[index] = num
}
if (column.property === "volumeWeight") {
let volume = this.calcSum("volume", data);
......@@ -653,6 +663,7 @@ export default {
orderItemIdList: item.boxOrderItemList.map(
(data) => data.orderItemId
),
isCover: 0
};
createGoods(params)
......
......@@ -72,10 +72,7 @@
<dict-tag :type="DICT_TYPE.CUSTOMER_OPERATE_TYPE" :value="row.operateType"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('操作人')" prop="operator">
<template v-slot="{row}">
{{operatorFn(row.operator)}}
</template>
<el-table-column :label="$t('操作人')" prop="operatorName">
</el-table-column>
<el-table-column :label="$t('操作时间')" prop="operator">
<template v-slot="{row}">
......@@ -119,7 +116,7 @@
<dict-tag :type="DICT_TYPE.CUSTOMER_OPERATE_TYPE" :value="dataLog.operateType"></dict-tag>
</el-form-item>
<el-form-item :label="$t('操作人')+':'">
{{operatorFn(dataLog.operator)}}
{{dataLog.operatorName}}
</el-form-item>
<el-form-item :label="$t('操作时间')+':'">
{{parseTime(dataLog.createTime)}}
......
......@@ -948,7 +948,7 @@ export default {
getCustomer(id) {
return getCustomer(id).then(response => {
console.log(response,'response')
this.form = { ...this.form, ...response.data, id: this.customerId,transportType: response.data.transportType.split(','),customerBanks:response.data.customerBankBackVOList };
this.form = { ...this.form, ...response.data, id: this.customerId,transportType: response.data.transportType && response.data.transportType !== '' ? response.data.transportType.split(',') : [],customerBanks:response.data.customerBankBackVOList };
this.open = true;
this.title = this.$t('修改客户');
this.getZhongPao()
......
......@@ -105,7 +105,8 @@
</el-table-column>
<el-table-column :label="$t('客户名称')" align="center" prop="name">
<template slot-scope="{row}">
{{$l(row, 'name')}} <el-tag v-if="row.isInOpenSea" size="mini">{{ $t('') }}</el-tag>
<p style="display:inline-block;white-space:pre-wrap;">{{$l(row, 'name')}}</p>
<el-tag v-if="row.isInOpenSea" size="mini">{{ $t('') }}</el-tag>
</template>
</el-table-column>
......
......@@ -15,7 +15,7 @@
<el-card style="margin-top: 15px;">
<el-descriptions :column="4" border>
<el-descriptions-item :label="$t('客户编号')">{{ customer.number }}</el-descriptions-item>
<el-descriptions-item :label="$t('客户名称')">{{ customer.name}}</el-descriptions-item>
<el-descriptions-item :label="$t('客户名称')"><span style="white-space: pre-wrap;">{{ customer.name}}</span></el-descriptions-item>
<el-descriptions-item :label="$t('客户英文名称')">{{customer.nameEn }}</el-descriptions-item>
<el-descriptions-item :label="$t('结算方式')">{{ getDictDataLabel(DICT_TYPE.CUSTOMER_BALANCE, customer.balance) }}</el-descriptions-item>
<el-descriptions-item :label="$t('客户生日')">{{ parseTime(customer.birthday, '{y}-{m}-{d}') }}</el-descriptions-item>
......
......@@ -87,7 +87,7 @@
</el-table-column>
<el-table-column :label="$t('客户名称')" align="center" prop="name" >
<template v-slot="{row}">
{{$l(row, 'name')}}
<p style="display:inline-block;white-space: pre-wrap;">{{$l(row, 'name')}}</p>
</template>
</el-table-column>
<el-table-column :label="$t('客户等级')" align="center" prop="vipLevelNameZh">
......
......@@ -98,7 +98,7 @@
</el-table-column>
<el-table-column :label="$t('客户名称')" align="center" prop="name" >
<template v-slot="{row}">
{{$l(row, 'name')}}
<p style="display:inline-block;white-space: pre-wrap;">{{$l(row, 'name')}}</p>
</template>
</el-table-column>
<el-table-column :label="$t('客户等级')" align="center" prop="vipLevelNameZh">
......
......@@ -87,7 +87,7 @@
</el-table-column>
<el-table-column :label="$t('客户名称')" align="center" prop="name" >
<template v-slot="{row}">
{{$l(row, 'name')}}
<p style="display:inline-block;white-space: pre-wrap;">{{$l(row, 'name')}}</p>
</template>
</el-table-column>
<el-table-column :label="$t('客户等级')" align="center" prop="vipLevelNameZh">
......
......@@ -92,7 +92,7 @@
</el-table-column>
<el-table-column :label="$t('客户名称')" align="center" prop="name" >
<template v-slot="{row}">
{{$l(row, 'name')}}
<p style="display:inline-block;white-space: pre-wrap;">{{$l(row, 'name')}}</p>
</template>
</el-table-column>
<el-table-column :label="$t('客户等级')" align="center" prop="vipLevelNameZh">
......
......@@ -6,7 +6,7 @@
<div class="offer-header">
<span style="font-size: 15px;">{{$t('报价单号')}}{{list.number}}</span>
<div class="btns">
<el-button v-hasPermi="['ecw:offer:update']" size="mini" type="primary" v-if="list.status!=5" @click="$router.push('edit?id=' + offerId)">{{$t('编辑')}}</el-button>
<el-button v-hasPermi="['ecw:offer:update']" size="mini" type="primary" v-if="[4,5,6].indexOf(list.status) == -1" @click="$router.push('edit?id=' + offerId)">{{$t('编辑')}}</el-button>
<el-button v-hasPermi="['ecw:offer:loglist']" type="primary" v-if="[1,3,7].indexOf(list.status) > -1" size="mini" @click="handleAdd">{{$t('跟进')}}</el-button>
<el-button v-hasPermi="['ecw:offer:result']" type="primary" v-if="[3,7].indexOf(list.status) > -1" size="mini" @click="toResult">{{$t('结果')}}</el-button>
<el-button v-hasPermi="['ecw:offer:discount','ecw:offer:commission']" size="mini" v-if="[1,3,7].indexOf(list.status) > -1" type="primary" @click.native="$router.push('/offer/special?offerId=' + offerId)" >{{$t('特价')}}</el-button>
......
......@@ -91,7 +91,7 @@
<el-table-column :label="$t('唛头')" align="center" prop="marks" />
<el-table-column :label="$t('箱数')" align="center" prop="sumNum" >
<template v-slot="{row}">
{{row.inWarehouseState > 1 ? row.sumNum : row.totalNum}}
{{row.sumNum > 0 ? row.sumNum : row.totalNum}}
</template>
</el-table-column>
<el-table-column :label="$t('已放箱数')" align="center" prop="sumWeight">
......
......@@ -68,7 +68,7 @@
</el-table-column>
</el-table>
</template>
<warehouse-record v-if="currentWarehouseRecord" :list="currentWarehouseRecord" append-to-body></warehouse-record>
<warehouse-record v-if="currentWarehouseRecord" :list="currentWarehouseRecord" append-to-body @close="currentWarehouseRecord=null"></warehouse-record>
</div>
</template>
<script>
......
......@@ -37,7 +37,8 @@
{{detail.marks}}
</td>
<td style="text-align:center;padding:0 0px;border:1px dashed #ccc;">
{{item.prodTitleZh}}<br/>{{item.prodTitleEn}}
<div style="white-space: nowrap">{{item.prodTitleZh}}</div>
<div style="white-space: nowrap">{{item.prodTitleEn}}</div>
</td>
<td style="text-align:center;padding:0 0px;border:1px dashed #ccc;">
{{item.cartonsNum}}
......
......@@ -84,7 +84,7 @@
<send-sms-code :order-id="detail.orderId" scene="5" />
</el-form-item>
<el-form-item label="" style="margin-top:20px">
<el-button type="success" @click="submit">{{$t('确认货')}}</el-button>
<el-button type="success" @click="submit">{{$t('确认货')}}</el-button>
<el-button type="default" @click="closeDialog">{{$t('关闭')}}</el-button>
</el-form-item>
</el-form>
......
......@@ -138,7 +138,8 @@ export default {
getReleaseInfo(this.orderId).then(res => this.detail = res.data)
seasoningCondimentsSelect({orderId: this.orderId}).then(res => {
res.data.forEach(item => {
item.releaseNum = item.sumNum - item.releaseNum
item.release = item.releaseNum
item.releaseNum = item.sumNum - item.release
})
this.orders = res.data
})
......@@ -155,7 +156,7 @@ export default {
// 放货箱数不能大于可放货箱数
let errNos = []
this.selectedOrders.forEach(item => {
if(item.releaseNum > item.sumNum - item.releaseNum){
if(item.releaseNum > item.sumNum - item.release){
errNos.push(item.orderNo)
}
})
......
<template>
<!-- 放入弹层 -->
<el-dialog :title="$t('入仓记录放入确认')" :visible="show" :before-close="closeDialog" :close-on-click-modal="false" width="1500px" :append-to-body="appendToBody">
<el-card>
<div slot="header">{{$t('可拆出入仓记录')}}</div>
<el-table :data="[warehouseRecord]">
<el-table-column :label="$t('箱数')" prop="cartonsNum">
<template slot-scope="{row}">{{Math.min(row.cartonsNum, maxNum)}}</template>
</el-table-column>
<el-table-column :label="$t('入仓类型')" prop="specificationType">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" :value="row.specificationType" />
</template>
</el-table-column>
<el-table-column :label="$t('包装类型')" prop="unit">
<template slot-scope="{row}">
<dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" :value="row.unit" />
</template>
</el-table-column>
<el-table-column :label="$t('长')" prop="boxGauge">
<template slot-scope="{row}">
{{row.boxGauge.split('*')[0]}}
</template>
</el-table-column>
<el-table-column :label="$t('宽')" prop="boxGauge" >
<template slot-scope="{row}">
{{row.boxGauge.split('*')[1]}}
</template>
</el-table-column>
<el-table-column :label="$t('高')" prop="boxGauge" >
<template slot-scope="{row}">
{{row.boxGauge.split('*')[2]}}
</template>
</el-table-column>
<el-table-column :label="$t('体积') + '(m³)'" prop="volume" />
<el-table-column :label="$t('重量') + '(kg)'" prop="weight" />
<el-table-column :label="$t('数量(个)')" prop="quantityAll" />
<el-table-column :label="$t('入仓快递单号')" prop="expressNo" />
<el-table-column :label="$t('首次入仓时间')" prop="inTime" >
<template slot-scope="{row}">{{row.inTime|parseTime}}</template>
</el-table-column>
<el-table-column :label="$t('储位')" prop="orderLocationBackVOList" >
<template slot-scope="{row}">
{{getLocationName(row.orderLocationBackVOList)}}
</template>
</el-table-column>
</el-table>
<div>
{{$t('可拆')}}:
{{maxSplitNum}}{{$t('箱')}},
{{$t('体积')}}:{{leftData('volume')}}{{$t('m³')}},
{{$t('重量')}}:{{leftData('weight')}}{{$t('kg')}},
{{$t('数量')}}:{{leftData('quantity')}}{{$t('个')}}
</div>
</el-card>
<el-card class="box-card mt-10">
<div slot="header" class="clearfix">
<span>{{ $t('新入仓记录') }}</span>
<el-button style="float: right;margin-left: 15px" size="mini" type="primary" icon="el-icon-minus" circle @click="deleteRow" :disabled="form.list.length <= 1"></el-button>
<el-button style="float: right" size="mini" type="primary" icon="el-icon-plus" circle @click="addRow"></el-button>
</div>
<el-form ref="form" :model="form" label-width="100px" size="mini">
<el-table
:data="form.list"
style="width: 100%">
<el-table-column :label="$t('箱数')" width="200px">
<template v-slot:header>
<span style="color: red">*</span>{{ $t('箱数') }}
</template>
<template v-slot="{row,$index}">
<el-form-item class="flex" label-width="0"
:prop="`list.${$index}.num`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<!--需求方要求输入后马上计算其他数据,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)" @change="calc(row)" :min="1" :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>
</el-table-column>
<el-table-column :label="$t('包装类型')" width="100px">
<template v-slot:header>
<span style="color: red">*</span>{{ $t('包装类型') }}
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<dict-selector :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="row.unit" defaultable></dict-selector>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="长(cm)">
<template v-slot:header>
<span>{{ $t('') }}</span>(cm)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.boxGauge1" @blur="calcVolume(row)"/>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="宽(cm)">
<template v-slot:header>
<span>{{ $t('') }}</span>(cm)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.boxGauge2" @blur="calcVolume(row)" />
</el-form-item>
</template>
</el-table-column>
<el-table-column label="高(cm)">
<template v-slot:header>
<span>{{ $t('') }}</span>(cm)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.boxGauge3" @blur="calcVolume(row)"/>
</el-form-item>
</template>
</el-table-column>
<el-table-column label="入仓体积(m³)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('体积') }}</span>(m³)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`list.${$index}.volume`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0.01" :max="warehouseRecord.volume" class="w-100 tight" v-model="row.volume"/>
</el-form-item>
</template>
</el-table-column>
<!--<el-table-column label="收费体积(m³)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('收费体积') }}</span>(m³)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`list.${$index}.chargeVolume`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.chargeVolume"/>
</el-form-item>
</template>
</el-table-column>-->
<el-table-column label="入仓重量(Kg)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('入仓重量') }}</span>(Kg)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`list.${$index}.weight`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0.01" :max="warehouseRecord.weight" class="w-75 tight" v-model="row.weight"/>
</el-form-item>
</template>
</el-table-column>
<!--<el-table-column label="收费重量(Kg)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('收费重量') }}</span>(Kg)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`list.${$index}.chargeWeight`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-75 tight" v-model="row.chargeWeight" type="number"/>
</el-form-item>
</template>
</el-table-column>-->
<el-table-column :label="$t('数量')" width="130px">
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`list.${$index}.quantity`"
:rules="{required: false, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" :max="warehouseRecord.quantityAll > 0 ? warehouseRecord.quantityAll : null" class="w-75 tight" v-model.number="row.quantity" />{{ $t('') }}
</el-form-item>
</template>
</el-table-column>
<el-table-column :label="$t('快递单号')">
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input v-model="row.expressNo"></el-input>
</el-form-item>
</template>
</el-table-column>
<el-table-column :label="$t('储位')" prop="orderLocationBackVOList">
<template v-slot="{ row, column, $index }">
<!--<el-button type="primary" size="mini" @click="showLocation(row, $index)">{{ $t('选择储位') }}</el-button>-->
<warehouse-area-select
v-model="row.orderLocationList"
:warehouse-id="warehouseId"
></warehouse-area-select>
</template>
</el-table-column>
<el-table-column :label="$t('操作')">
<template v-slot="{ row, column, $index}">
<el-popconfirm
v-if="$index > 0"
:title="$t('确定要删除该行入仓记录吗?')"
@confirm="deleteRow($index)"
>
<template v-slot:reference>
<el-button size="mini" type="danger">删除</el-button>
</template>
</el-popconfirm>
</template>
</el-table-column>
</el-table>
</el-form>
</el-card>
<div slot="footer">
<el-button type="primary" @click="submit">{{ $t('确定') }}</el-button>
</div>
</el-dialog>
</template>
<script>
import WarehouseAreaSelect from "@/components/WarehouseAreaSelect/index.vue";
import {parseTime} from '@/utils/ruoyi'
import Decimal from 'decimal.js'
import Template from "@/views/cms/template/index.vue";
export default {
name: "Putin",
filters:{parseTime},
components: {Template, WarehouseAreaSelect},
props:{
warehouseRecord:Object,
appendToBody: Boolean,
// 仓库ID,选择储位要用到
warehouseId: Number,
// 数量是否必须
quantityshow: Boolean,
// 最大可拆箱数,装柜拆单用
maxNum: Number
},
data(){
return {
show: false,
// 拆出的入仓记录
form:{
list:[]
}
}
},
computed:{
// 计算总拆出数据
splitTotal(){
return field => {
let total = new Decimal(0)
this.form.list.forEach(item => {
total = total.plus(new Decimal(item[field] || 0))
})
return total.toNumber()
}
},
// 剩余数据
leftData(){
return (field, containNew = false) => {
// 入仓记录跟拆单记录的箱数字段不同,要做特殊处理
let warehouseField = field
if(field == 'num') warehouseField = 'cartonsNum'
if(field == 'quantity') warehouseField = 'quantityAll'
let left = new Decimal(this.warehouseRecord[warehouseField] || 0)
// 累减已拆记录
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()
}
},
// 可拆箱数
maxSplitNum(){
return Math.min(this.maxNum, this.leftData('num'))
}
},
mounted() {
this.show = true
this.$nextTick(this.addRow)
},
methods:{
// 添加一行
addRow(){
let { specificationType, boxGauge1, boxGauge2, boxGauge3, expressNo, unit } = this.warehouseRecord
let num = Math.min(this.leftData('num', true), this.maxSplitNum)
let orderLocationList = this.warehouseRecord.orderLocationBackVOList
if(this.form.list.length){
orderLocationList = this.form.list[this.form.list.length - 1].orderLocationList
}
// 根据入仓记录添加一行
let row = {
warehouseInId: this.warehouseRecord.id,
specificationType, boxGauge1, boxGauge2, boxGauge3, expressNo,unit,
volume: 0,
weight: 0,
num: num,
quantity: 0,
orderLocationList
}
// 按照比例计算重量体积和数量
this.calc(row)
this.form.list.push(row)
},
// 删除一行,可选参数index表上行号,参数不是数字则删除最后一行
deleteRow(index){
const spliceIndex = typeof index !== 'number' ? this.list - 1 : index
this.form.list.splice(spliceIndex, 1)
},
// 计算体积
calcVolume(row){
let volume = Decimal(row.boxGauge1 || 0)
.times(Decimal(row.boxGauge2 || 0))
.times(Decimal(row.boxGauge3 || 0)).div(1000000)
// 如果是箱的单位要乘以箱数
if(row.specificationType === 1) {
row.volume = volume.times(Decimal(row.num || 0))
}
// 最低0.01
volume = Math.max(0.01, volume.toNumber().toFixed(2))
this.$set(row, 'volume', volume)
},
// 获取储位名称
getLocationName(locationArr){
if(!locationArr || !locationArr.length) return ''
let arr = []
locationArr.forEach(item => {
arr.push(`${item.areaName}${item.locationName || ''}`)
})
return Array.from(new Set(arr)).join(",")
},
// 根据箱数计算体积,重量,数量
calc(row){
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(0)
},
closeDialog(){
this.show = false
this.$emit('close');
},
submit(){
this.$refs.form.validate(valid => {
if(!valid){
return false
}
if(this.splitTotal('num') > this.maxSplitNum){
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){
if(this.splitTotal('volume') !== this.warehouseRecord.volume){
return this.$message.error("全拆拆出体积必须等于原入仓体积")
}
if(this.splitTotal('weight') !== this.warehouseRecord.weight){
return this.$message.error("全拆拆出体积必须等于原入仓体积")
}
}
this.$emit('submit', this.form.list)
})
}
}
}
</script>
<style scoped>
.input{
border: 1px solid #DCDFE6;
padding: 5px 6px;
border-radius: 5px;
}
</style>
......@@ -31,14 +31,19 @@
</el-table-column>
<el-table-column :label="$t('体积') + '(m³)'" prop="volume" />
<el-table-column :label="$t('重量') + '(kg)'" prop="weight" />
<el-table-column :label="$t('数量(个)')" prop="quantityAll" />
<el-table-column :label="$t('数量(个)')" prop="quantity" />
<!--<el-table-column :label="$t('入仓快递单号')" prop="expressNo" />-->
<!--<el-table-column :label="$t('首次入仓时间')" prop="inTime" >
<template slot-scope="{row}">{{row.inTime|parseTime}}</template>
</el-table-column>-->
<el-table-column :label="$t('储位')" prop="orderLocationBackVOList" >
<template slot-scope="{row}">
{{getLocationName(row.orderLocationBackVOList)}}
<!--{{getLocationName(row.orderLocationList)}}-->
<warehouse-area-select
v-model="row.orderLocationList"
readonly
:warehouse-id="warehouseId"
></warehouse-area-select>
</template>
</el-table-column>
</el-table>
......@@ -46,13 +51,17 @@
</template>
<script>
import WarehouseAreaSelect from "@/components/WarehouseAreaSelect/index.vue";
export default {
name: "WarehouseRecord",
components: {WarehouseAreaSelect},
props:{
list:{
type: Array,
default: []
},
warehouseId: Number,
appendToBody: Boolean
},
data(){
......
......@@ -142,9 +142,7 @@
</p>
</div>
<div>
<el-button v-if="index==0" disabled type="primary" @click="addShop(index)">{{$t('放入')}}</el-button>
<el-button v-if="index!=0" type="primary" @click="addShop(index)">{{$t('放入')}}</el-button>
<!--<el-button v-if="index==0" disabled type="primary" plain @click="deleteSplit(item.id)">{{$t('删除')}}</el-button>-->
<el-button type="primary" @click="addShop(index)">{{$t('放入')}}</el-button>
<el-button :disabled="index < splitData.length - 1" type="primary" plain @click="deleteSplit(item.id)">{{$t('删除')}}</el-button>
</div>
</div>
......@@ -165,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>
......@@ -205,8 +203,7 @@
</el-table-column>
<el-table-column :label="$t('操作')" align="center">
<template slot-scope="scope">
<el-button v-if="index==0" disabled size="mini" type="text" icon="el-icon-delete" @click="removeShop(scope.row.id)">{{$t('移出')}}</el-button>
<el-button v-else 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>
</template>
</el-table-column>
</el-table>
......@@ -214,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>
......@@ -246,197 +248,155 @@
</el-dialog>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="$t('放入品名')" :visible.sync="shopOpen" width="1500px" append-to-body>
<el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="120px" size="mini">
<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-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="120px" inline>
<el-form-item :label="$t('中文品名')">
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择中文品名')">
<el-option v-for="item in orderData.orderItemVOList" :label="item.prodTitleZh" :value="item.orderItemId" :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-form-item :label="$t('英文品名')">
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择英文品名')">
<el-option v-for="item in orderData.orderItemVOList" :label="item.prodTitleEn" :value="item.orderItemId" :key="item.prodTitleEn" ></el-option>
</el-select>
</el-form-item>
<el-form-item :label="$t('剩余数据')">
<div>{{$t('剩余箱数')}}{{ shopForm.sum || 0 }}</div>
<div>
{{ $t('入仓方数') }}:{{ mainOrderItem.volume || 0 }}m³
{{ $t('收费方数') }}:{{ mainOrderItem.chargeVolume || 0 }}m³
</div>
<div>
{{ $t('入仓重量') }}:{{ mainOrderItem.weight || 0 }}kg
{{ $t('收费重量') }}:{{ mainOrderItem.chargeWeight || 0 }}kg
</div>
<div>
{{ $t('数量(个)') }}:{{ mainOrderItem.quantity || 0 }}
{{ $t('剩余货值') }}:{{ mainOrderItem.worth || 0 }}{{ $t('元') }}
</div>
</el-form-item>
<el-card class="box-card" v-if="shopForm.specsRecordVOList">
<div slot="header" class="clearfix">
<span>{{ $t('入仓记录') }}</span>
<el-button style="float: right;margin-left: 15px" size="mini" type="primary" icon="el-icon-minus" circle @click="deleteRow" :disabled="shopForm.specsRecordVOList.length <= 1"></el-button>
<el-button style="float: right" size="mini" type="primary" icon="el-icon-plus" circle @click="addRow" :disabled="!shopForm.orderItemId"></el-button>
<div class="page-title">{{$t('品名可拆数据')}}</div>
<div class="pl-20">
<span class="mr-10">{{$t('箱数')}}:{{ leftData.num || 0 }}</span>
<span class="mr-10">{{ $t('入仓方数') }}:{{ leftData.volume || 0 }}m³</span>
<span class="mr-10">{{ $t('收费方数') }}:{{ leftData.chargeVolume || 0 }}m³</span>
<span class="mr-10">{{ $t('入仓重量') }}:{{ leftData.weight || 0 }}kg</span>
<span class="mr-10">{{ $t('收费重量') }}:{{ leftData.chargeWeight || 0 }}kg</span>
<span class="mr-10">{{ $t('数量(个)') }}:{{ leftData.quantity || 0 }}</span>
<span class="mr-10">{{ $t('剩余货值') }}:{{ leftData.worth || 0 }}{{ $t('元') }}</span>
</div>
<!--<el-form ref="tableForm" :model="shopForm" size="mini">-->
<div class="page-title">{{$t('可拆入仓记录')}}</div>
<el-table
:data="shopForm.specsRecordVOList"
:data="getOrderItemWarehouseIn(shopForm.orderItemId)"
style="width: 100%">
<el-table-column :label="$t('箱数')" width="200px">
<template v-slot:header>
<span style="color: red">*</span>{{ $t('箱数') }}
</template>
<el-table-column :label="$t('箱数')">
<template v-slot="{row,$index}">
<el-form-item class="flex" label-width="0"
:prop="`specsRecordVOList.${$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" type="number"></el-input-number>
<dict-selector class="w-75" :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" v-model="row.specificationType" defaultable></dict-selector>
</el-form-item>
<!--{{row.cartonsNum}}-->
{{getWarehouseLeftData(row, 'num')}}
<dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" v-model="row.specificationType"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('包装类型')" width="100px">
<template v-slot:header>
<span style="color: red">*</span>{{ $t('包装类型') }}
</template>
<el-table-column :label="$t('包装类型')">
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<dict-selector :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="row.unit" defaultable></dict-selector>
</el-form-item>
<dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="row.unit"></dict-tag>
</template>
</el-table-column>
<el-table-column label="长(cm)">
<template v-slot:header>
<span>{{ $t('') }}</span>(cm)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.boxGauge1" @blur="calcVolume(row)"/>
</el-form-item>
{{row.boxGauge1}}
</template>
</el-table-column>
<el-table-column label="宽(cm)">
<template v-slot:header>
<span>{{ $t('') }}</span>(cm)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.boxGauge2" @blur="calcVolume(row)" />
</el-form-item>
{{ row.boxGauge2 }}
</template>
</el-table-column>
<el-table-column label="高(cm)">
<template v-slot:header>
<span>{{ $t('') }}</span>(cm)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.boxGauge3" @blur="calcVolume(row)"/>
</el-form-item>
{{ row.boxGauge3 }}
</template>
</el-table-column>
<el-table-column label="入仓体积(m³)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('体积') }}</span>(m³)
</template>
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`specsRecordVOList.${$index}.volume`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.volume"/>
</el-form-item>
{{getWarehouseLeftData(row, 'volume')}}
</template>
</el-table-column>
<el-table-column label="收费体积(m³)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('收费体积') }}</span>(m³)
<el-table-column label="入仓重量(Kg)" prop="weight">
<template v-slot="{row,$index}">
{{getWarehouseLeftData(row, 'weight')}}
</template>
</el-table-column>
<el-table-column :label="$t('数量')" prop="quantity">
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`specsRecordVOList.${$index}.chargeVolume`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.chargeVolume"/>
</el-form-item>
{{getWarehouseLeftData(row, 'quantity')}}
</template>
</el-table-column>
<el-table-column :label="$t('快递单号')" prop="expressNo"></el-table-column>
<el-table-column :label="$t('储位')" prop="orderLocationBackVOList">
<template v-slot="{ row, column, $index }">
{{getLocationName(row.orderLocationBackVOList)}}
</template>
</el-table-column>
<el-table-column :label="$t('操作')">
<template v-slot="{ row, column, $index}">
<el-tag v-if="getWarehouseInSplitData(row.id,'num') >= row.cartonsNum" disabled size="mini" type="primary" >{{$t('已拆完')}}</el-tag>
<el-button v-else size="mini" type="primary" @click="putInRecord(row)">放入</el-button>
</template>
</el-table-column>
<el-table-column label="入仓重量(Kg)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('入仓重量') }}</span>(Kg)
</el-table>
<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%">
<el-table-column :label="$t('箱数')" width="200px">
<template v-slot="{row,$index}">
{{row.num}}
<dict-tag :type="DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE" v-model="row.specificationType"></dict-tag>
</template>
</el-table-column>
<el-table-column :label="$t('包装类型')" width="100px">
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`specsRecordVOList.${$index}.weight`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.weight"/>
</el-form-item>
<dict-tag :type="DICT_TYPE.ECW_PACKAGING_TYPE" v-model="row.unit"></dict-tag>
</template>
</el-table-column>
<el-table-column label="收费重量(Kg)">
<template v-slot:header>
<span style="color: red">*</span> <span>{{ $t('收费重量') }}</span>(Kg)
<el-table-column label="长(cm)">
<template v-slot="{row,$index}">
{{row.boxGauge1}}
</template>
</el-table-column>
<el-table-column label="宽(cm)">
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`specsRecordVOList.${$index}.chargeWeight`"
:rules="{required: true, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-100 tight" v-model="row.chargeWeight" type="number"/>
</el-form-item>
{{ row.boxGauge2 }}
</template>
</el-table-column>
<el-table-column :label="$t('数量')" width="130px">
<el-table-column label="高(cm)">
<template v-slot="{row,$index}">
<el-form-item label-width="0"
:prop="`specsRecordVOList.${$index}.quantity`"
:rules="{required: quantityshow, message: $t('不能为空'), trigger: 'blur'}">
<el-input-number controls-position="right" :min="0" class="w-75 tight" v-model.number="row.quantity" />{{ $t('') }}
</el-form-item>
{{ row.boxGauge3 }}
</template>
</el-table-column>
<el-table-column :label="$t('快递单号')">
<el-table-column label="入仓体积(m³)">
<template v-slot="{row,$index}">
<el-form-item label-width="0">
<el-input v-model="row.expressNo"></el-input>
</el-form-item>
{{row.volume}}
</template>
</el-table-column>
<!--<el-table-column label="收费体积(m³)" prop="chargeVolume"></el-table-column>-->
<el-table-column label="入仓重量(Kg)" prop="weight"></el-table-column>
<!--<el-table-column label="收费重量(Kg)" prop="chargeWeight"></el-table-column>-->
<el-table-column :label="$t('数量')" width="130px" prop="quantity"></el-table-column>
<el-table-column :label="$t('快递单号')" prop="expressNo"></el-table-column>
<el-table-column :label="$t('储位')" prop="orderLocationBackVOList">
<template v-slot="{ row, column, $index }">
<!--<el-button type="primary" size="mini" @click="showLocation(row, $index)">{{ $t('选择储位') }}</el-button>-->
<warehouse-area-select
v-model="row.orderLocationList"
:warehouse-id="splitData[splitItemIndex].dstWarehouseId"
></warehouse-area-select>
{{getLocationName(row.orderLocationList)}}
</template>
</el-table-column>
<el-table-column :label="$t('操作')">
<template v-slot="{ row, column, $index}">
<el-popconfirm
v-if="$index > 0"
:title="$t('确定要删除该行入仓记录吗?')"
@confirm="deleteRow($index)"
>
<template v-slot:reference>
<el-button size="mini" type="danger">删除</el-button>
</template>
</el-popconfirm>
<el-button size="mini" type="primary" @click="deleteRow($index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<!--</el-form>-->
</el-card>
<el-form-item :label="$t('放入数据')">
<div>{{$t('箱数')}}{{ putin.num || 0 }}</div>
<div>
{{ $t('入仓方数') }}:{{ putin.volume || 0 }}m³
{{ $t('收费方数') }}:{{ putin.chargeVolume || 0 }}m³
</div>
<div>
{{ $t('入仓重量') }}:{{ putin.weight || 0 }}kg
{{ $t('收费重量') }}:{{ putin.chargeWeight || 0 }}kg
</div>
<div>
{{ $t('数量(个)') }}:{{ putin.quantity || 0 }}
<div class="page-title">放入数据</div>
<div class="pl-20 mb-10">
<span class="mr-10">{{$t('箱数')}}:{{ putin.num || 0 }},</span>
<span class="mr-10">{{ $t('数量(个)') }}:{{ putin.quantity || 0 }},</span>
<span class="mr-10">{{ $t('入仓方数') }}:{{ putin.volume || 0 }}m³, </span>
<span class="mr-10">{{ $t('入仓重量') }}:{{ putin.weight || 0 }}kg</span>
</div>
<el-form-item :label="$t('收费方数')" prop="chargeVolume">
<el-input-number v-model="shopForm.chargeVolume" controls-position="right"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费重量')" prop="chargeWeight">
<el-input-number v-model="shopForm.chargeWeight" controls-position="right"></el-input-number>kg
</el-form-item>
<el-form-item :label="$t('放入货值')">
......@@ -449,7 +409,7 @@
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="shopAdd">{{$t('确定')}}</el-button>
<el-button type="primary" @click="shopAdd" :disabled="!shopForm.specsRecordVOList || !shopForm.specsRecordVOList.length">{{$t('确定')}}</el-button>
<el-button @click="shopCancel">{{$t('取消')}}</el-button>
</div>
</el-dialog>
......@@ -485,7 +445,19 @@
</span>
</el-dialog>
<warehouse-record v-if="currentWarehouseRecord" :list="currentWarehouseRecord"></warehouse-record>
<warehouse-record
v-if="currentWarehouseRecord"
:list="currentWarehouseRecord"
:warehouseId="currentWarehouseId"
@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>
......@@ -504,19 +476,23 @@ import {
import {getWarehouseList, quantityRequired} from '@/api/ecw/warehouse'
import {getChannelList} from '@/api/ecw/channel'
import WorkFlow from '@/components/WorkFlow'
import {getOrder, splitItemUpdate} from '@/api/ecw/order'
import {getOrder, getOrderWarehouseIn, splitItemUpdate} from '@/api/ecw/order'
import Decimal from 'decimal.js'
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,
WorkFlow
WorkFlow,
PutIn
},
data() {
return {
......@@ -550,11 +526,11 @@ export default {
},
// 表单校验
shopRules: {
prodTitleZh: [{ required: true, message: this.$t("请选择中文品名"), trigger: "change" }],
prodTitleEn: [{ required: true, message: this.$t("请选择英文品名"), trigger: "change" }],
chargeVolume: [{ required: true, message: this.$t("请填写收费方数"), trigger: "blur" }],
chargeWeight: [{ required: true, message: this.$t("请填写收费重量"), trigger: "blur" }],
},
queryParams:{
orderId:7,
orderId: null,
lang:0
},
query:{
......@@ -564,7 +540,13 @@ export default {
splitItemIndex:0,
quantitySum:0,
// 当前查看的入仓记录
currentWarehouseRecord: null
currentWarehouseRecord: null,
// 订单入仓记录
warehouseInList: [],
// 当前选择的入仓记录ID
// selectedWarehouseInId: null,
// 当前正在放入的入仓记录
currentPutIn: null
};
},
async created() {
......@@ -579,20 +561,13 @@ 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确认不需要询问,直接重置
// TODO 20230610 方便调试不删除,改完之后要取消注释
/*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()
}
})
// 获取入仓记录
getOrderWarehouseIn(this.queryParams.orderId).then(res => {
this.warehouseInList = res.data
})
},
watch: {
//监听table这个对象
......@@ -619,6 +594,10 @@ export default {
if(!show){
this.shopForm = {}
}
},
// 切换品名需要重置已放入的记录
'shopForm.orderItemId'(){
this.shopForm.specsRecordVOList = []
}
},
computed:{
......@@ -638,32 +617,145 @@ export default {
if(!this.orderItem.orderItemId || !this.splitData.length || !this.splitData[0].orderSplitItemBackVOList) return {}
return this.splitData[0].orderSplitItemBackVOList.find(item => item.orderItemId == this.orderItem.orderItemId) || {}
},
// 剩余可拆数据,父订单的入仓数据 - 全部拆单的品名数据
leftData(){
if(!this.shopForm.orderItemId) return {}
let data = {
num: new Decimal(this.orderItem.warehouseInInfoVO?.cartonsNum || 0),
volume: new Decimal(this.orderItem.warehouseInInfoVO?.volume || 0),
weight: new Decimal(this.orderItem.warehouseInInfoVO?.weight || 0),
quantity: new Decimal(this.orderItem.warehouseInInfoVO?.quantityAll || 0),
chargeVolume: new Decimal(this.orderItem.chargeVolume || 0),
chargeWeight: new Decimal(this.orderItem.chargeWeight || 0),
worth: new Decimal(this.orderItem.worth || 0),
}
// 全部拆单的放入数据累减
this.splitData.forEach(split => {
split.orderSplitItemBackVOList.forEach(splitItem => {
// 每个品名的入仓记录挨个累减其他数据
if(splitItem.orderItemId == this.shopForm.orderItemId){
// 每个品名都要累减收费数据
data.chargeVolume = data.chargeVolume.minus(new Decimal(splitItem.chargeVolume || 0))
data.chargeWeight = data.chargeWeight.minus(new Decimal(splitItem.chargeWeight || 0))
data.worth = data.worth.minus(new Decimal(splitItem.worth || 0))
data.num = data.num.minus(new Decimal(splitItem.num || 0))
data.volume = data.volume.minus(new Decimal(splitItem.volume || 0))
data.weight = data.weight.minus(new Decimal(splitItem.weight || 0))
data.quantity = data.quantity.minus(new Decimal(splitItem.quantity || 0))
}
})
})
return data
},
// 放入数据
putin(){
let data = {
num: new Decimal(0),
volume: new Decimal(0),
chargeVolume: new Decimal(0),
weight: new Decimal(0),
chargeWeight: new Decimal(0),
quantity: new Decimal(0)
}
this.shopForm.specsRecordVOList && this.shopForm.specsRecordVOList.forEach(item => {
data.num = data.num.plus(new Decimal(item.num || 0))
data.volume = data.volume.plus(new Decimal(item.volume || 0))
data.chargeVolume = data.chargeVolume.plus(new Decimal(item.chargeVolume || 0))
data.weight = data.weight.plus(new Decimal(item.weight || 0))
data.chargeWeight = data.chargeWeight.plus(new Decimal(item.chargeWeight || 0))
data.quantity = data.quantity.plus(new Decimal(item.quantity || 0))
})
return {
num: data.num.toNumber(),
volume: data.volume.toNumber(),
chargeVolume: data.chargeVolume.toNumber(),
weight: data.weight.toNumber(),
chargeWeight: data.chargeWeight.toNumber(),
quantity: data.quantity.toNumber()
}
},
// 当前仓库ID,选择储位的时候需要用到
currentWarehouseId(){
return this.orderData.adjustToDestWarehouseId || this.orderData.logisticsInfoDto.startWarehouseId
},
// 当前选择的入仓记录
/*currentWarehouseItem(){
return this.getOrderItemWarehouseIn(this.shopForm.orderItemId).find(item => item.id === this.selectedWarehouseInId)
},*/
// 根据orderItemId获取入仓记录
getOrderItemWarehouseIn() {
return orderItemId => {
const list = this.warehouseInList.find(item => item.orderItemId == orderItemId)?.orderWarehouseInBackItemDoList || []
return list.map(item => {
let [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*')
let labelArr = [
this.$t('{num}箱', {num: item.cartonsNum}),
this.$l(this.getDictDatas(this.DICT_TYPE.WAREHOUSING_SPECIFICATION_TYPE).find(dict => dict.value == item.specificationType), 'label'),
this.$t('长{boxGauge1}cm', {boxGauge1}),
this.$t('宽{boxGauge2}cm', {boxGauge2}),
this.$t('高{boxGauge3}cm', {boxGauge3}),
this.$t('方数{volume}m³', {volume: item.volume}),
this.$t('重量{weight}kg', {weight: item.weight})
]
if (item.quantityAll) {
labelArr.push(this.$t('数量{n}', {n: item.quantityAll}))
}
if (item.expressNo) {
labelArr.push(this.$t('快递{expressNo}', {expressNo: item.expressNo}))
}
if (item.orderLocationBackVOList && item.orderLocationBackVOList.length) {
labelArr.push(this.$t('储位{location}', {
location: item.orderLocationBackVOList.map(v => v.code || v.areaName + (v.locationName || '')).join(',')
}))
}
item.boxGauge1 = boxGauge1
item.boxGauge2 = boxGauge2
item.boxGauge3 = boxGauge3
item.text = labelArr.join(',')
return item
})
}
},
// 根据入仓记录ID筛选出他的全部拆出记录
getWarehouseInspecsRecordVOList(){
return warehouseInId => {
let specsRecordVOList = []
// 这里是全部已放入的
this.splitData.forEach(split => {
split.orderSplitItemBackVOList.forEach(splitItem => {
splitItem.specsRecordVOList && splitItem.specsRecordVOList.forEach(specs => {
if(specs.warehouseInId === warehouseInId){
specsRecordVOList.push(specs)
}
})
})
})
// 这里是全部正在操作放入,但是还没确定提交的
this.shopForm.specsRecordVOList.forEach(item => {
if(item.warehouseInId == warehouseInId)specsRecordVOList.push(item)
})
return specsRecordVOList
}
},
// 根据入仓ID获取拆出数据
getWarehouseInSplitData(){
return (warehouseInId, field) => {
let total = new Decimal(0)
this.getWarehouseInspecsRecordVOList(warehouseInId).forEach(item => {
total = total.plus(new Decimal(item[field] || 0))
})
return total.toNumber()
}
},
// 获取入仓记录的剩余数据
getWarehouseLeftData(){
return (warehouseRecord, field) => {
let warehouseField = field
if(field == 'num') warehouseField = 'cartonsNum'
if(field == 'quantity') warehouseField = 'quantityAll'
let total = new Decimal(warehouseRecord[ warehouseField ] || 0)
this.getWarehouseInspecsRecordVOList(warehouseRecord.id).forEach(item => {
total = total.minus(new Decimal(item[field] || 0))
})
return total.toNumber()
}
}
},
methods: {
......@@ -767,47 +859,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
......@@ -820,6 +871,8 @@ export default {
addShop(index){
this.splitItemIndex = index
this.shopOpen = true
// 重置表单数据
this.shopForm = {specsRecordVOList:[]}
},
addSplit(){
this.form.transportId = this.orderData.transportId
......@@ -832,7 +885,7 @@ export default {
}
this.open = true
},
changeProdTitleZh(val){
/*changeProdTitleZh(val){
var list = []
list = this.splitData[0].orderSplitItemBackVOList.filter(item=>item.id == val)
this.shopForm.sum = list[0].num
......@@ -846,7 +899,8 @@ export default {
}
this.numcheck()
},
},*/
// 查询数量是否必填
numcheck(){
quantityRequired(this.orderData.lineId).then(res=>{
this.quantityshow = res.data
......@@ -905,6 +959,13 @@ export default {
if (!valid) {
return;
}
if(!this.shopForm.specsRecordVOList.length){
return this.$message.error(this.$t("请放入品名"));
}
// 放入数据不能大于可拆数据
if(this.putin.num > this.leftData.num){
return this.$message.error(this.$t("放入箱数不能大于可拆箱数"));
}
this.shopForm.specsRecordVOList.forEach(item => {
item.boxGauge = `${item.boxGauge1}*${item.boxGauge2}*${item.boxGauge3}`
})
......@@ -914,15 +975,33 @@ export default {
orderSplitId:this.splitData[this.splitItemIndex].id,
remark:this.shopForm.remark,
volume: this.putin.volume,
chargeVolume: this.putin.chargeVolume,
chargeVolume: this.shopForm.chargeVolume,
weight: this.putin.weight,
chargeWeight: this.putin.chargeWeight,
worth: this.shopForm.worth,
chargeWeight: this.shopForm.chargeWeight,
worth: this.shopForm.worth || 0,
specsRecordVOList:this.shopForm.specsRecordVOList
}
if(this.quantityshow){
params.quantity = this.shopForm.quantity
// 体积重量不能为0
const fields = {
'volume': this.$t('体积'),
'weight': this.$t('重量'),
'chargeVolume': this.$t('收费体积'),
'chargeWeight': this.$t('收费重量'),
}
let errFields = []
Object.keys(fields).forEach(field => {
if(params[field] < 0.01){
errFields.push(fields[field])
}
})
if(errFields.length){
return this.$message.error(this.$t("{field}最少为0.01", {field: errFields.join(",")}))
}
/*if(this.quantityshow){
params.quantity = this.shopForm.quantity
}*/
createSplitItem(params).then(async res=>{
this.$message.success(this.$t("放入成功"));
await this.getList()
......@@ -966,14 +1045,21 @@ export default {
})
},
// 添加一行
addRow(){
/*addRow(){
if(!this.shopForm.specsRecordVOList){
this.$set(this.shopForm,'specsRecordVOList',[])
}
if(!this.currentWarehouseItem){
return this.$message.info(this.$t("请选择入仓记录"))
}
let { specificationType, boxGauge1, boxGauge2, boxGauge3, volume, weight } = this.currentWarehouseItem
let num = this.currentWarehouseItem.cartonsNum
// 根据入仓记录添加一行
this.shopForm.specsRecordVOList.push({
orderLocationList: []
specificationType, boxGauge1, boxGauge2, boxGauge3, volume, weight,num,
orderLocationList: this.currentWarehouseItem.orderLocationBackVOList
})
},
},*/
// 删除一行,可选参数index表上行号,参数不是数字则删除最后一行
deleteRow(index){
const spliceIndex = typeof index !== 'number' ? this.shopForm.specsRecordVOList.length - 1 : index
......@@ -1000,6 +1086,51 @@ export default {
return this.$message.info(this.$t('暂无入仓记录'))
}
this.currentWarehouseRecord = row.specsRecordVOList
},
// 获取储位名称
getLocationName(locationArr){
if(!locationArr || !locationArr.length) return ''
let arr = []
locationArr.forEach(item => {
arr.push(`${item.areaName || ''}${item.locationName || ''}`)
})
return Array.from(new Set(arr)).join(",")
},
// 根据入仓记录打开放入弹层
putInRecord(row){
this.currentPutIn = row
// 此条入仓记录已拆出的入仓记录,这样在放入的时候可以确保不超过此入仓记录的数量
let specsRecordVOList = this.getWarehouseInspecsRecordVOList(row.id)
this.currentPutIn.specsRecordVOList = specsRecordVOList
},
// 放入回调
handlePutin(list){
if(!list.length){
return this.$message.error(this.$t("请至少放入一条数据"))
}
list.forEach(item => {
this.shopForm.specsRecordVOList.push({...item})
})
this.currentPutIn = null
// 根据比例计算默认的收费方数和收费重量
const orderItem = this.orderData.orderItemVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
const rate = this.putin.num / orderItem.warehouseInInfoVO.cartonsNum
this.$set(this.shopForm, 'chargeVolume', (orderItem.chargeVolume*rate).toFixed(2))
this.$set(this.shopForm, 'chargeWeight', (orderItem.chargeWeight*rate).toFixed(2))
this.$set(this.shopForm, 'worth', (orderItem.worth*rate).toFixed(2))
},
// 清空放入记录
clearAll(){
this.$confirm(this.$t("确定要清空放入数据么?")).then(res => {
this.shopForm.specsRecordVOList = []
})
},
// 重置
reset(){
deleteAllSplit(this.queryParams.orderId).then(res => {
this.getList()
})
}
}
}
......
......@@ -63,7 +63,7 @@
</el-table-column>
<el-table-column :label="$t('创建人')" align="center" prop="creator" width="180">
<template v-slot="{row}">
{{(row.creator && allSimplList.length) && allSimplList.find(i => i.id == row.creator).nickname}}
{{(row.creator && allSimplList.length) && allSimplList.find(i => i.id == row.creator) && allSimplList.find(i => i.id == row.creator).nickname}}
</template>
</el-table-column>
<el-table-column :label="$t('创建时间')" align="center" prop="createTime" width="180">
......@@ -73,7 +73,7 @@
</el-table-column>
<el-table-column :label="$t('修改人')" align="center" prop="updater" width="180">
<template v-slot="{row}">
{{ (row.updater && allSimplList.length) && allSimplList.find(i => i.id == row.updater).nickname}}
{{ (row.updater && allSimplList.length) && allSimplList.find(i => i.id == row.updater) && allSimplList.find(i => i.id == row.updater).nickname}}
</template>
</el-table-column>
<el-table-column :label="$t('修改时间')" align="center" prop="createTime" width="180">
......
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