Commit 2bb0f0fc authored by dragondean@qq.com's avatar dragondean@qq.com

Merge branch 'release'

# Conflicts:
#	src/views/ecw/box/shippingSea/nodePage/cabinet/splitOrder.vue
#	src/views/ecw/financial/creatCollection.vue
#	src/views/ecw/order/splitApply.vue
parents 08b6cfdb 7338569c
......@@ -46,11 +46,20 @@ export default {
align-items: center;
justify-content: center;
}
.flex-between{
display: flex;
justify-content: space-between;
}
.empty-placeholder{
padding: 50px;
text-align: center;
}
$sizes: 0, 10,20,30,50,100,150,200,300,500,800,1000;
/*给el-input-number一个紧凑的样式*/
.el-input-number.is-controls-right.tight .el-input__inner{
padding-right: 30px;
padding-left: 5px;
}
$sizes: 0, 10,20,30,50,75,100,150,200,300,500,800,1000;
@for $i from 1 through length($sizes){
$item: nth($sizes, $i);
.ml-#{$item}{
......
......@@ -343,3 +343,10 @@ export function updateUrl(data) {
data,
});
}
export function dealCustomsSplitNotify(notifyId){
return request({
url: `/shipment/box/dealCustomsSplitNotify?notifyId=${notifyId}`,
method: "get",
})
}
......@@ -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
})
}
......
......@@ -52,6 +52,8 @@ export default {
this.list.unshift(res.data)
this.index = 0
})
}else{
this.index = index
}
},
remoteMethod(keyword){
......@@ -61,6 +63,9 @@ export default {
getCustomerSelect(params)
.then(res => this.list = res.data.list)
.finally(() => this.loading = false)
},
reset(){
this.index=null
}
}
}
......
......@@ -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
})
})
})
......@@ -285,7 +288,10 @@ export default {
},
// 用于储位回显选中
isSelected(warehouse, area, position = 0){
return !!this.value.find(e => warehouse === e.wareId && area === e.areaId && (position === e.locationId || undefined === e.locationId))
return !!this.value.find(e => {
// 最后一个条件不能用!e.locationId来判断,会导致选择了没有locationId的全部被选中,上次改这里忘记什么原因了,下次复现再来调整
return warehouse === e.wareId && area === e.areaId && (position === e.locationId || e.locationId == undefined)
})
},
}
}
......
......@@ -94,10 +94,14 @@ export default {
}
},
created() {
this.updateMessage()
// 未避免频繁内存溢出,减少请求记录感染,开发的时候不轮询消息
if(process.env.NODE_ENV != 'development'){
setInterval(() => {
this.updateMessage()
}, 10000)
}
this.updateMessage()
},
components: {
Breadcrumb,
......
......@@ -281,6 +281,11 @@ export default {
component: "BoxSplitDetail",
id: this.processInstance.businessKey,
},
// 退场拆单,跟出货装柜拆单一样
exit_split: {
component: "BoxSplitDetail",
id: this.processInstance.businessKey,
},
merge_detail: {
component: "MergeDetail",
id: this.processInstance.businessKey,
......
......@@ -2,13 +2,13 @@
<div class="app-container">
<!-- 搜索工作栏 -->
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item :label="$t('流程编号')" prop="processId">
<el-form-item :label="$t('流程编号')" prop="instanceId">
<el-input v-model="queryParams.instanceId" :placeholder="$t('请输入流程编号')" clearable/>
</el-form-item>
<el-form-item :label="$t('流程名称')" prop="processName">
<el-input v-model="queryParams.processName" :placeholder="$t('请输入任务名称')" clearable/>
</el-form-item>
<el-form-item :label="$t('流程分类')" prop="processName">
<el-form-item :label="$t('流程分类')" prop="categoryId">
<el-select v-model="queryParams.categoryId" :placeholder="$t('请选择流程分类')" clearable>
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.BPM_MODEL_CATEGORY)"
:key="dict.value" :label="$l(dict, 'label')" :value="dict.value"/>
......
......@@ -198,7 +198,7 @@ import {
getbox,
getboxPage,
exportboxExcel,
getNoticeList,
getNoticeList, dealCustomsSplitNotify,
} from "@/api/ecw/box";
import {
downloadFile,
......@@ -426,7 +426,7 @@ export default {
}
},
/** 查看按钮操作 */
handleCommand(row, command) {
async handleCommand(row, command) {
this.$set(this.dialogCfg, "fullscreen", false);
switch (command) {
......@@ -513,6 +513,9 @@ export default {
if ([5, 6, 7].includes(noticeType)) {
this.$router.push("/boxSea/query/" + row.id);
}
if([9].includes(noticeType)){
await dealCustomsSplitNotify(row.notifyId)
}
this.closeDialog();
break;
}
......
......@@ -141,42 +141,47 @@
</el-table-column>
<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">
<span slot="append">{{ $t('') }}</span>
</el-input>
</template>
</el-table-column>
<el-table-column :label="$t('箱数')" align="center">
<template slot-scope="scope">
<span>{{scope.row.num}}</span>
<el-button type="text" @click="showWarehouse(scope.row)">{{scope.row.num}}</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('数量(个)')" align="center">
<template slot-scope="scope">
<span>{{scope.row.quantity}}</span>
</template>
</el-table-column>
......@@ -205,80 +210,188 @@
</div>
<!-- 对话框(添加 / 修改) -->
<el-dialog :title="$t('放入品名')" :visible.sync="shopOpen" width="500px" append-to-body>
<el-form ref="shopForm" :model="shopForm" :rules="shopRules" label-width="150px">
<el-row>
<el-dialog :title="$t('放入品名')" :visible.sync="shopOpen" width="1500px" append-to-body>
<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-option v-for="item in orderItems" :label="item.prodTitleZh" :value="item.orderItemId" :key="item.id" :disabled="itemDisabled(item)"></el-option>
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择中文品名')">
<el-option v-for="item in orderItems" :label="item.prodTitleZh" :value="item.orderItemId" :key="item.id"></el-option>
</el-select>
</el-form-item>
</el-row>
<el-row>
<el-form-item :label="$t('英文品名')+':'" prop="orderItemId">
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择英文品名')" @change="onProdChange">
<el-option v-for="item in orderItems" :label="item.prodTitleEn" :value="item.orderItemId" :key="item.id" :disabled="itemDisabled(item)"></el-option>
<el-select v-model="shopForm.orderItemId" :placeholder="$t('请选择英文品名')">
<el-option v-for="item in orderItems" :label="item.prodTitleEn" :value="item.orderItemId" :key="item.id"></el-option>
</el-select>
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item :label="$t('剩余箱数')+':'">
{{shopForm.leftNum||0}}
</el-form-item>
</el-col>
<!--剩余数量计算不出来,显示没意义-->
<!--<el-col :span="12" v-show="isQuantity">
<el-form-item :label="$t('剩余数量(个)')+':'">
{{shopForm.leftQuantity||0}}
</el-form-item>
</el-col>-->
</el-row>
<el-form-item :label="$t('放入箱数')+':'">
<el-input-number v-model="shopForm.num" controls-position="right" :min="0" :max="+shopForm.leftNum" @change="calcAverg"></el-input-number>
</el-form-item>
<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="getOrderItemWarehouseIn(shopForm.orderItemId)"
style="width: 100%">
<el-table-column :label="$t('箱数')">
<template v-slot="{row,$index}">
{{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('包装类型')">
<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="长(cm)">
<template v-slot="{row,$index}">
{{row.boxGauge1}}
</template>
</el-table-column>
<el-table-column label="宽(cm)">
<template v-slot="{row,$index}">
{{ row.boxGauge2 }}
</template>
</el-table-column>
<el-table-column label="高(cm)">
<template v-slot="{row,$index}">
{{ row.boxGauge3 }}
</template>
</el-table-column>
<el-table-column label="入仓体积(m³)">
<template v-slot="{row,$index}">
{{getWarehouseLeftData(row, 'volume')}}
</template>
</el-table-column>
<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}">
{{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="$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-form-item v-if="mainOrderItem.orderItemId" label-width="0">
{{ $t('剩余入仓方数') }}:{{ mainOrderItem.volume || 0 }}m³,
{{$t('剩余收费方数')}}:{{ mainOrderItem.chargeVolume || 0 }}m³
</el-form-item>
<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}">
<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="{row,$index}">
{{row.boxGauge1}}
</template>
</el-table-column>
<el-table-column label="宽(cm)">
<template v-slot="{row,$index}">
{{ row.boxGauge2 }}
</template>
</el-table-column>
<el-table-column label="高(cm)">
<template v-slot="{row,$index}">
{{ row.boxGauge3 }}
</template>
</el-table-column>
<el-table-column label="入仓体积(m³)">
<template v-slot="{row,$index}">
{{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 }">
{{getLocationName(row.orderLocationList)}}
</template>
</el-table-column>
<el-table-column :label="$t('操作')">
<template v-slot="{ row, column, $index}">
<el-button size="mini" type="primary" @click="deleteRow($index)">删除</el-button>
</template>
</el-table-column>
</el-table>
<el-form-item :label="$t('入仓体积')">
<el-input-number v-model="shopForm.volume" controls-position="right" :min="0" :max="mainOrderItem.volume"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费体积')">
<el-input-number v-model="shopForm.chargeVolume" controls-position="right" :min="0" :max="mainOrderItem.chargeVolume"></el-input-number>
</el-form-item>
<el-form-item v-if="mainOrderItem.orderItemId" label-width="0">
{{ $t('剩余入仓重量') }}:{{ mainOrderItem.weight || 0 }}kg,
{{$t('剩余收费重量')}}:{{ mainOrderItem.chargeWeight || 0 }}kg
</el-form-item>
<el-form-item :label="$t('入仓重量')">
<el-input-number v-model="shopForm.weight" controls-position="right" :min="0" :max="mainOrderItem.weight"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费重量')">
<el-input-number v-model="shopForm.chargeWeight" controls-position="right" :min="0" :max="mainOrderItem.chargeWeight"></el-input-number>
<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 v-if="mainOrderItem.orderItemId" label-width="0">
{{ $t('剩余货值') }}:{{ mainOrderItem.worth || 0 }}{{ $t('元') }}
<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-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-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('备注信息')+':'">
<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-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>
<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>
......@@ -292,15 +405,23 @@ 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,
WorkFlow
},
props: {
......@@ -343,7 +464,15 @@ export default {
isQuantity: false,
// 主单数据
mainOrder: {orderSplitItemBackVOList: {}}
mainOrder: {orderSplitItemBackVOList: {}},
// 当前查看的入仓记录
currentWarehouseRecord: null,
// 订单入仓记录
warehouseInList: [],
// 当前选择的入仓记录ID
selectedWarehouseInId: null,
// 当前正在放入的入仓记录
currentPutIn: null
};
},
created() {
......@@ -353,6 +482,15 @@ export default {
this.queryParams.orderId = this.currRow.orderId;
this.getOrderDetail();
this.getSplit();
// 获取入仓记录
getOrderWarehouseIn(this.queryParams.orderId).then(res => {
this.warehouseInList = res.data
})
this.$nextTick(() => {
window.$vm = this
})
},
watch: {
//监听table这个对象
......@@ -373,6 +511,16 @@ export default {
});
},
},
// 切换放入品名
'shopForm.orderItemId'(){
// 默认取以前放入的品名
this.shopForm.specsRecordVOList = []
let specsRecordVOList = this.splitData.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId)?.specsRecordVOList || []
specsRecordVOList.forEach(item => {
const [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*')
this.shopForm.specsRecordVOList.push({...item, boxGauge1, boxGauge2, boxGauge3})
})
}
},
computed: {
isAudit() {
......@@ -395,6 +543,125 @@ export default {
mainOrderItem(){
if(!this.shopForm.orderItemId || !this.mainOrder.orderSplitItemBackVOList.length) return {}
return this.mainOrder.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId) || {}
},
// 放入数据
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.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: {
......@@ -435,13 +702,13 @@ export default {
this.mainOrder = data.find(item => item.isMaster)
});
},
itemDisabled(data) {
/*itemDisabled(data) {
const { orderSplitItemBackVOList = [] } = this.splitData;
const isExist = orderSplitItemBackVOList.find(
(item) => item.orderItemId === data.orderItemId
);
return isExist ? true : false;
},
},*/
/* 查询拆单项 */
querySplitGoods() {
getSplitList({
......@@ -536,102 +803,47 @@ 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)
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) {
// 放入箱数自动计算出来的,所以不需要在做判断了
/*
// 输入箱数大于实装箱数
const total = this.totalSplitNum();
const canSplitNum = Decimal.sub(
this.currRow.num,
this.currRow.installNum
).toNumber();
const remain = Decimal.sub(canSplitNum, total).toNumber();
if (this.shopForm.num > remain) {
this.$message.error(this.$t("放入箱数不能大于总箱数"));
return;
}*/
if (this.shopForm.num === 0) {
if (this.putin.num === 0) {
this.$message.error(this.$t("放入箱数不能为0"));
return;
}
if (this.shopForm.quantity === 0 && this.isQuantity) {
if (this.putin.quantity === 0 && this.isQuantity) {
this.$message.error(this.$t("放入数量(个)不能为0"));
return;
}
this.shopForm.specsRecordVOList.forEach(item => {
item.boxGauge = `${item.boxGauge1}*${item.boxGauge2}*${item.boxGauge3}`
})
let params = {
num: this.shopForm.num,
num: this.putin.num,
// quantity: this.shopForm.quantity,
orderItemId: this.shopForm.orderItemId,
orderSplitId: this.splitData.id,
remarks: this.shopForm.remarks,
volume: this.shopForm.volume,
weight: this.shopForm.weight,
volume: this.putin.volume,
weight: this.putin.weight,
chargeWeight: this.shopForm.chargeWeight,
chargeVolume: this.shopForm.chargeVolume,
worth: this.shopForm.worth
worth: this.shopForm.worth || 0,
specsRecordVOList:this.shopForm.specsRecordVOList,
shipmentSplit: true
};
// 按数量计费的才需要传递数量
if(this.isQuantity){
params.quantity = this.shopForm.quantity
params.quantity = this.putin.quantity
}
createSplitItem(params).then((res) => {
this.$message.success(this.$t("放入成功"));
this.querySplitGoods();
this.$refs["shopForm"].resetFields();
});
this.shopOpen = false;
});
}
});
},
......@@ -667,6 +879,102 @@ export default {
toReviewDetail.apply(this, [cabinetSplitInfo.bpmProcessId]);
this.$emit("closeDialog2", "close");
},
// 添加一行
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({
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
this.shopForm.specsRecordVOList.splice(spliceIndex, 1)
this.calcDefaultData()
},
// 计算体积
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)
this.$set(row, 'chargeVolume', volume)
},
// 显示入库记录
showWarehouse(row){
if(!row.specsRecordVOList){
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
this.calcDefaultData()
},
// 清空放入记录
clearAll(){
this.$confirm(this.$t("确定要清空放入数据么?")).then(res => {
this.shopForm.specsRecordVOList = []
this.calcDefaultData()
})
},
// 计算默认的收费数据
calcDefaultData() {
// 根据比例计算默认的收费方数和收费重量
const orderItem = this.orderData.orderItemVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
const rate = this.putin.num / orderItem.warehouseInInfoVO.cartonsNum
/*
* 1 普货 2 重货 3 泡货
* 普货 收费数据=入仓数据
* 泡货 收费方数=入仓方数 收费重量 = 品名收费重量*比例
* 重货 收费方数=品名收费方数*比例 收费重量 = 入仓重量
* */
const chargeVolume = orderItem.itemType === 2 ? (orderItem.chargeVolume*rate).toFixed(2) : this.putin.volume
const chargeWeight = orderItem.itemType === 3 ? (orderItem.chargeWeight*rate).toFixed(2) : this.putin.weight
this.$set(this.shopForm, 'chargeVolume', chargeVolume)
this.$set(this.shopForm, 'chargeWeight', chargeWeight)
this.$set(this.shopForm, 'worth', (orderItem.worth*rate).toFixed(2))
}
},
};
</script>
......
......@@ -264,6 +264,7 @@ export default {
},
methods: {
getCustomsOrderList(dcCustomsType) {
if(dcCustomsType) dcCustomsType = ''
customsOrderList({
shipmentId: this.shipmentObj.id,
customsTypes: dcCustomsType === "3" ? "2,3" : dcCustomsType,
......
......@@ -796,7 +796,7 @@ export default {
},
/* 获取参数 */
getParams() {
const { rucangtime = [] } = this.queryParams;
let rucangtime = this.queryParams.rucangtime?this.queryParams.rucangtime:[]
return {
...this.queryParams,
...this.$attrs.params,
......
......@@ -178,7 +178,7 @@ export default {
list.push({
...oItem,
warehouseInInfo,
multiSpecification: item.multiSpecification,
multiSpecification: oItem.multiSpecification,
positionNo: oItem.positionNo,
tallyStatus: item.tallyStatus,
tallyTime: item.tallyTime,
......
......@@ -19,6 +19,7 @@
>
<span style="margin-right:20px"><span style="color: #ff4949;">*</span>{{$t('客户')}}</span>
<customer-selector
ref="customer"
v-model="form.customerId"
@change="customerChange"
/>
......@@ -762,6 +763,7 @@ export default {
codePage: {
pageNo: 1,
pageSize: 100
},
pages:1
};
......@@ -772,10 +774,11 @@ export default {
this.id = this.$route.query.id;
this.getReceivableData()
}
console.log(this.$route.query.receiptId)
if (this.$route.query.receiptId && this.$route.query.receiptId !== '0') {
if (this.$route.query.receiptId && this.$route.query.receiptId != 0) {
this.receiptId = this.$route.query.receiptId;
this.getReceivableInfo()
}else{
this.removeData()
}
},
directives: {
......@@ -907,8 +910,8 @@ export default {
setTimeout(() => {
getBankAccountPage(this.codePage).then(res => {
this.codeLoading = false
this.pages = res.data.pages
this.bankData = this.bankData.concat(res.data.list)
this.pages = (res.data.total/this.codePage.pageSize)+1
})
}, 200)
},
......@@ -1223,7 +1226,7 @@ export default {
return NP.divide(this.currencyList.find(v => v.titleEn === 'NGN').huilv, 100).toFixed(6)
},
customerChange(value) {
if (this.flag) {
if (this.flag||!value) {
this.flag = false
return
}
......@@ -1492,6 +1495,19 @@ export default {
this.queryParams.page = 1;
this.getList()
},
//清空数据
removeData(){
console.log(this.form)
this.$refs.customer.reset()
this.list = []
for(var i in this.form){
if(i=='receiptAccountList'){
this.$set(this.form,i,[])
}else{
this.$set(this.form,i,'')
}
}
}
},
};
</script>
......
......@@ -46,27 +46,41 @@
<dict-tag :type="DICT_TYPE.ECW_IS_BRAND" :value="row.brandType" />
</template>
</el-table-column>
<el-table-column :label="$t('体积')">
<el-table-column :label="$t('入仓体积')">
<template slot-scope="{row}">{{row.volume}}</template>
</el-table-column>
<el-table-column :label="$t('重量')">
<el-table-column :label="$t('收费体积')">
<template slot-scope="{row}">{{row.chargeVolume}}</template>
</el-table-column>
<el-table-column :label="$t('入仓重量')">
<template slot-scope="{row}">{{row.weight}}kg</template>
</el-table-column>
<el-table-column :label="$t('收费重量')">
<template slot-scope="{row}">{{row.chargeWeight}}kg</template>
</el-table-column>
<el-table-column :label="$t('箱数')">
<template slot-scope="{row}">{{row.num}}</template>
<template slot-scope="{row}">
<el-button type="text" @click="showWarehouseRecord(row)">{{row.num}}</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('数量')">
<template slot-scope="{row}">{{row.quantity}}</template>
</el-table-column>
<el-table-column :label="$t('货值')">
<template slot-scope="{row}">{{row.worth}}{{$t('')}}</template>
</el-table-column>
</el-table>
</template>
<warehouse-record v-if="currentWarehouseRecord" :list="currentWarehouseRecord" append-to-body @close="currentWarehouseRecord=null"></warehouse-record>
</div>
</template>
<script>
import {getOrder} from '@/api/ecw/order'
import {getBoxApproval} from '@/api/ecw/box'
import {getChannel} from '@/api/ecw/channel'
import WarehouseRecord from "@/views/ecw/order/splitApply/components/WarehouseRecord";
export default {
components: {WarehouseRecord},
props:{
id: [String, Number]
},
......@@ -74,7 +88,9 @@ export default {
return {
detail: null,
order: null,
channel: null
channel: null,
// 查看入仓记录的条目
currentWarehouseRecord: null
}
},
watch:{
......@@ -110,6 +126,12 @@ export default {
getChannel(this.order.channelId).then(res => {
this.channel = res.data
})
},
showWarehouseRecord(row){
if(!row.specsRecordVOList){
return this.$message.info(this.$t('暂无入仓记录'))
}
this.currentWarehouseRecord = row.specsRecordVOList
}
}
}
......
......@@ -46,30 +46,44 @@
<dict-tag v-else :type="DICT_TYPE.ECW_IS_BRAND" :value="row.feeType" />
</template>
</el-table-column>
<el-table-column :label="$t('体积')">
<el-table-column :label="$t('入仓体积')">
<template slot-scope="{row}">{{row.volume}}</template>
</el-table-column>
<el-table-column :label="$t('重量')">
<el-table-column :label="$t('收费体积')">
<template slot-scope="{row}">{{row.chargeVolume}}</template>
</el-table-column>
<el-table-column :label="$t('入仓重量')">
<template slot-scope="{row}">{{row.weight}}kg</template>
</el-table-column>
<el-table-column :label="$t('收费重量')">
<template slot-scope="{row}">{{row.chargeWeight}}kg</template>
</el-table-column>
<el-table-column :label="$t('箱数')">
<template slot-scope="{row}">{{row.num}}</template>
<template slot-scope="{row}">
<el-button type="text" @click="showWarehouseRecord(row)">{{row.num}}</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('数量')">
<template slot-scope="{row}">{{row.quantity}}</template>
</el-table-column>
<el-table-column :label="$t('货值')">
<template slot-scope="{row}">{{row.worth}}{{$t('')}}</template>
</el-table-column>
<el-table-column :label="$t('备注')">
<template slot-scope="{row}">{{row.remark}}</template>
</el-table-column>
</el-table>
</template>
<warehouse-record v-if="currentWarehouseRecord" :list="currentWarehouseRecord" append-to-body @close="currentWarehouseRecord=null"></warehouse-record>
</div>
</template>
<script>
import {getApproval, getOrder} from '@/api/ecw/order'
import {getChannel} from '@/api/ecw/channel'
import {getSplitList} from '@/api/ecw/orderHandle'
import WarehouseRecord from "@/views/ecw/order/splitApply/components/WarehouseRecord";
export default {
components: {WarehouseRecord},
props:{
id: [String, Number]
},
......@@ -78,7 +92,9 @@ export default {
detail: null,
order: null,
channel: null,
orderSplitBackVOList: []
// orderSplitBackVOList: [],
// 查看入仓记录的条目
currentWarehouseRecord: null
}
},
watch:{
......@@ -86,7 +102,7 @@ export default {
this.getData()
},
detail(){
this.getSplit()
// this.getSplit()
this.getOrder()
},
order(){
......@@ -95,6 +111,11 @@ export default {
}
}
},
computed:{
orderSplitBackVOList(){
return this.detail ? this.detail.orderSplitBackVOList : []
}
},
created(){
if(this.id){
this.getData()
......@@ -106,12 +127,12 @@ export default {
this.detail = JSON.parse(res.data.details)
})
},
getSplit(){
/*getSplit(){
getSplitList({orderId: this.detail.orderId, lang: this.$i18n.locale.toLowerCase().indexOf('zh') > -1 ? 0 : 1 }).then(res => {
console.log('getSplitList', res)
this.orderSplitBackVOList = res.data.orderSplitBackVOList
})
},
},*/
getOrder(){
getOrder(this.detail.orderId).then(res => {
this.order = res.data
......@@ -121,6 +142,12 @@ export default {
getChannel(this.order.channelId).then(res => {
this.channel = res.data
})
},
showWarehouseRecord(row){
if(!row.specsRecordVOList){
return this.$message.info(this.$t('暂无入仓记录'))
}
this.currentWarehouseRecord = row.specsRecordVOList
}
}
}
......
......@@ -2,7 +2,7 @@
<div>
<el-descriptions class="margin-top" border :column="4">
<el-descriptions-item :label="$t('唛头')">{{details.marks}}</el-descriptions-item>
<el-descriptions-item label="已到箱数/总箱数">{{details.sumNum || 0}}/{{details.costVO ? details.costVO.totalNum : 0}}</el-descriptions-item>
<el-descriptions-item label="已到箱数/总箱数">{{details.sumNum || 0}}/{{details.sumNum || 0 }}</el-descriptions-item>
<el-descriptions-item :label="$t('订单状态')">
<dict-tag :type="DICT_TYPE.ORDER_STATUS" :value="details.status" />
</el-descriptions-item>
......
......@@ -29,7 +29,8 @@
<el-table-column
:label="$t('入仓统计')">
<template v-slot="{row}">
<div>总箱数:{{row.totalNum}}</div>
<div>总箱数:{{row.sumNum}}</div>
<div>体积:{{row.sumVolume}}CBM </div>
<div>重量:{{row.sumWeight}}kg</div>
</template>
......
<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">
<input class="input" v-model="row.boxGauge1" type="number" @keyup="calcVolume(row)" @change="calcVolume(row)" :min="0"></input>
<!--<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">
<input class="input" v-model="row.boxGauge2" type="number" @keyup="calcVolume(row)" @change="calcVolume(row)" :min="0"></input>
<!--<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">
<input class="input" v-model="row.boxGauge3" type="number" @keyup="calcVolume(row)" @change="calcVolume(row)" :min="0"></input>
<!--<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()
}
},
// 计算此入仓记录全部拆出的数量,包含其他拆单订单的
totalSplitSum(){
return field => {
let total = new Decimal(0)
if(this.warehouseRecord.specsRecordVOList && this.warehouseRecord.specsRecordVOList.length){
this.warehouseRecord.specsRecordVOList.forEach(item => {
total = total.plus(new Decimal(item[field] || 0))
})
}
return total.plus(new Decimal(this.splitTotal('num'))).toNumber()
}
},
// 剩余数据
leftData(){
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.$nextTick(() =>{
if(this.leftData('num', true) <= 0 ) {
row.volume = this.leftData('volume', true)
row.weight = this.leftData('weight', true)
row.quantity = this.leftData('quantity', true)
}else{
// 按照比例计算重量体积和数量
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){
// 改了规格后按照规格计算体积
this.$set(row, 'calcVolumeByBoxGauge', 1)
let volume = Decimal(row.boxGauge1 || 0)
.times(Decimal(row.boxGauge2 || 0))
.times(Decimal(row.boxGauge3 || 0)).div(1000000)
// 如果是箱的单位要乘以箱数
if(+row.specificationType === 1) {
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)
// 如果是按照规格计算体积,则重新计算
if(row.calcVolumeByBoxGauge){
this.calcVolume(row)
}
},
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>
<template>
<!-- 拆单入仓记录 -->
<el-dialog :title="$t('入仓记录')" :visible="show" :before-close="closeDialog" :close-on-click-modal="false" width="1000px" :append-to-body="appendToBody">
<el-table :data="list">
<el-table-column type="index" :label="$t('序号')" />
<el-table-column :label="$t('箱数')" prop="num" />
<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="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.orderLocationList)}}-->
<warehouse-area-select
v-model="row.orderLocationList"
readonly
:warehouse-id="warehouseId"
></warehouse-area-select>
</template>
</el-table-column>
</el-table>
</el-dialog>
</template>
<script>
import WarehouseAreaSelect from "@/components/WarehouseAreaSelect/index.vue";
import {parseTime} from "@/utils/ruoyi";
export default {
name: "WarehouseRecord",
components: {WarehouseAreaSelect},
filters: {parseTime},
props:{
list:{
type: Array,
default: []
},
warehouseId: Number,
appendToBody: Boolean
},
data(){
return {
show: false
}
},
mounted() {
this.show = true
},
methods:{
parseTime,
// 获取储位名称
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(",")
},
closeDialog(){
this.show = false
this.$emit('close');
},
}
}
</script>
<style scoped>
</style>
......@@ -5,10 +5,6 @@
<div slot="header" class="card-title">{{$t('拆单申请')}}-{{orderData.orderNo||''}}</div>
<div class="btn-header">
<span class="card-title">{{$t('原单信息')}}</span>
<div>
<span v-if="orderData.abnormalState!=0" class="red">{{$t('异常无法拆单')}}</span>
<el-button v-else type="primary" @click="addSplit" :disabled="orderData.inWarehouseState==207">{{$t('新建拆单')}} </el-button>
</div>
</div>
<el-descriptions :column="4">
<el-descriptions-item :label="$t('唛头')">
......@@ -108,6 +104,7 @@
<span style="margin-left: 10px;">{{$t('箱数')}}:{{!scope.row.warehouseInInfoVO?0:scope.row.warehouseInInfoVO.cartonsNum}}</span>
<span style="margin-left: 10px;">{{$t('体积')}}:{{!scope.row.warehouseInInfoVO?0:scope.row.warehouseInInfoVO.volume}}m³</span>
<span style="margin-left: 10px;">{{$t('重量')}}:{{!scope.row.warehouseInInfoVO?0:scope.row.warehouseInInfoVO.weight}}kg</span>
<span style="margin-left: 10px;">{{$t('数量(个)')}}:{{!scope.row.warehouseInInfoVO?0:scope.row.warehouseInInfoVO.quantityAll}}</span>
</el-row>
<el-row v-if="!scope.row.warehouseInInfoVO">
<span>{{$t('暂时没有入仓信息')}}</span>
......@@ -127,9 +124,16 @@
</el-table-column>
</el-table>
</el-card>
<el-card class="card" v-if="splitData.length>0">
<el-card class="card">
<!-- 列表 -->
<div slot="header" class="card-title">{{$t('拆单信息')}}</div>
<div slot="header" class="card-title flex">
<div style="flex: 1; display: flex; align-items: center">{{$t('拆单信息')}}</div>
<div>
<span v-if="orderData.abnormalState!=0" class="red">{{$t('异常无法拆单')}}</span>
<el-button v-else type="primary" @click="addSplit" :disabled="orderData.inWarehouseState==207">{{$t('新建拆单')}} </el-button>
</div>
</div>
<template v-if="splitData.length>0">
<div v-for="(item, index) in splitData" :key="index">
<div class="btn-header">
<div>
......@@ -142,9 +146,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>
......@@ -162,62 +164,68 @@
<dict-tag v-else :type="DICT_TYPE.ECW_IS_BRAND" :value="scope.row.feeType" />
</template>
</el-table-column>
<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">
<span slot="append"></span>
</el-input>
{{scope.row.volume}}
</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">
<span slot="append">kg</span>
</el-input>
{{scope.row.weight}}kg
</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>
</el-table-column>
<el-table-column :label="$t('箱数')" align="center">
<el-table-column :label="$t('箱数')" align="center" prop="num">
<template slot-scope="scope">
<span>{{scope.row.num}}</span>
<el-button type="text" @click="currentWarehouseRecord=scope.row.specsRecordVOList">
{{ scope.row.num }}
</el-button>
</template>
</el-table-column>
<el-table-column :label="$t('数量(个)')" align="center" prop="quantity"></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>
</div>
</template>
<el-empty v-else></el-empty>
</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="cancel">{{$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>
......@@ -244,63 +252,181 @@
</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-dialog :title="$t('放入品名')" :visible.sync="shopOpen" width="1500px" append-to-body>
<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 :label2="$t('剩余箱数')" v-if="mainOrderItem.orderItemId">
{{$t('剩余箱数')}}{{ shopForm.sum || 0 }}<!--,可放入箱数:{{ mainOrderItem.num - 1 }}-->
</el-form-item>
<el-form-item :label="$t('放入箱数')">
<el-input-number v-model="shopForm.num" @change="numChange" controls-position="right" :min="1" :max="mainOrderItem.num"></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="mainOrderItem.quantity-1" :placeholder="$t('最多可放入{quantity}', {
quantity: mainOrderItem.quantity-1
})"></el-input-number>
</el-form-item>
<el-form-item v-if="mainOrderItem.orderItemId">
<div>{{ $t('剩余入仓方数') }}:{{ mainOrderItem.volume || 0 }}m³<!--,{{$t('可放入仓方数')}}:{{ (mainOrderItem.volume - 0.01).toFixed(2) }}m³--></div>
<div>{{$t('剩余收费方数')}}:{{ mainOrderItem.chargeVolume || 0 }}m³<!--,{{$t('可放入收费方数')}}:{{ (mainOrderItem.chargeVolume - 0.01).toFixed(2) }}m³--></div>
</el-form-item>
<el-form-item :label="$t('入仓方数')">
<el-input-number v-model="shopForm.volume" controls-position="right" :min="0" :max="mainOrderItem.volume"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费方数')">
<el-input-number v-model="shopForm.chargeVolume" controls-position="right" :min="0" :max="mainOrderItem.chargeVolume"></el-input-number>
</el-form-item>
<el-form-item v-if="mainOrderItem.orderItemId">
<div>{{$t('剩余入仓重量')}}:{{ mainOrderItem.weight || 0 }}kg<!--,{{$t('可放入重量')}}:{{ mainOrderItem.weight }}kg--></div>
<div>{{$t('剩余收费重量')}}:{{ mainOrderItem.chargeWeight || 0 }}kg<!--,{{$t('可放入收费重量')}}:{{ mainOrderItem.chargeWeight }}kg--></div>
</el-form-item>
<el-form-item :label="$t('入仓重量')">
<el-input-number v-model="shopForm.weight" controls-position="right" :min="0" :max="mainOrderItem.weight"></el-input-number>
</el-form-item>
<el-form-item :label="$t('收费重量')">
<el-input-number v-model="shopForm.chargeWeight" controls-position="right" :min="0" :max="mainOrderItem.chargeWeight"></el-input-number>
<el-card>
<div slot="header" 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-card>
<el-card class="mt-10">
<div slot="header" class="page-title">{{$t('可拆入仓记录')}}</div>
<el-table
:data="getOrderItemWarehouseIn(shopForm.orderItemId)"
style="width: 100%">
<el-table-column :label="$t('箱数')">
<template v-slot="{row,$index}">
<!--{{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('包装类型')">
<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="长(cm)">
<template v-slot="{row,$index}">
{{row.boxGauge1}}
</template>
</el-table-column>
<el-table-column label="宽(cm)">
<template v-slot="{row,$index}">
{{ row.boxGauge2 }}
</template>
</el-table-column>
<el-table-column label="高(cm)">
<template v-slot="{row,$index}">
{{ row.boxGauge3 }}
</template>
</el-table-column>
<el-table-column label="入仓体积(m³)">
<template v-slot="{row,$index}">
{{getWarehouseLeftData(row, 'volume')}}
</template>
</el-table-column>
<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}">
{{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>
</el-card>
<el-card class="mt-10">
<div slot="header" 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}">
<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="{row,$index}">
{{row.boxGauge1}}
</template>
</el-table-column>
<el-table-column label="宽(cm)">
<template v-slot="{row,$index}">
{{ row.boxGauge2 }}
</template>
</el-table-column>
<el-table-column label="高(cm)">
<template v-slot="{row,$index}">
{{ row.boxGauge3 }}
</template>
</el-table-column>
<el-table-column label="入仓体积(m³)">
<template v-slot="{row,$index}">
{{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 }">
{{getLocationName(row.orderLocationList)}}
</template>
</el-table-column>
<el-table-column :label="$t('操作')">
<template v-slot="{ row, column, $index}">
<el-button size="mini" type="primary" @click="deleteRow($index)">删除</el-button>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card class="mt-10">
<div slot="header" class="page-title">放入数据</div>
<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 v-if="mainOrderItem.orderItemId">
<div>{{$t('剩余货值')}}:{{ mainOrderItem.worth || 0 }}{{ $t('元') }}</div>
<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">
<template slot="append">{{ $t('') }}</template>
</el-input-number>
</el-form-item>
<el-form-item :label="$t('备注信息')+':'">
<el-form-item :label="$t('备注信息')">
<el-input v-model="shopForm.remark"></el-input>
</el-form-item>
</div>
</el-card>
</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>
......@@ -319,6 +445,36 @@
<el-button type="primary" @click="cancelSplit">{{$t('确定')}}</el-button>
</span>
</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>
<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>
......@@ -337,15 +493,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 Template from "@/views/cms/template";
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,
WorkFlow
WarehouseRecord,
WarehouseDetail,
WarehouseAreaSelect,
WorkFlow,
PutIn
},
data() {
return {
......@@ -368,7 +532,9 @@ export default {
selectedUsers:[],
shopOpen:false,
quantityshow:false,
shopForm:{},
shopForm:{
specsRecordVOList: []
},
// 表单校验
rules: {
transportId: [{ required: true, message: this.$t("请选择运输方式"), trigger: "change" }],
......@@ -377,19 +543,27 @@ 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:{
page:1,
rows:20
},
splitItemIndex:0,
quantitySum:0
// splitItemIndex:0,
quantitySum:0,
// 当前查看的入仓记录
currentWarehouseRecord: null,
// 订单入仓记录
warehouseInList: [],
// 当前选择的入仓记录ID
// selectedWarehouseInId: null,
// 当前正在放入的入仓记录
currentPutIn: null
};
},
async created() {
......@@ -404,19 +578,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确认不需要询问,直接重置
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这个对象
......@@ -443,6 +611,19 @@ export default {
if(!show){
this.shopForm = {}
}
},
// 切换品名需要重置已放入的记录
'shopForm.orderItemId'(){
// 默认取以前放入的品名
let split = this.splitData.find(item => item.id == this.splitData[this.splitIndex].id)
this.shopForm.specsRecordVOList = []
if(split) {
let specsRecordVOList = split.orderSplitItemBackVOList.find(item => item.orderItemId == this.shopForm.orderItemId)?.specsRecordVOList || []
specsRecordVOList.forEach(item => {
const [boxGauge1, boxGauge2, boxGauge3] = item.boxGauge.split('*')
this.shopForm.specsRecordVOList.push({...item, boxGauge1, boxGauge2, boxGauge3})
})
}
}
},
computed:{
......@@ -459,8 +640,157 @@ export default {
},
// 主单数据,也就是拆分剩余的数据,可用来限制拆单放入的最大值
mainOrderItem(){
if(!this.orderItem.orderItemId || !this.splitData.length || !this.splitData[0].orderSplitItemBackVOList) return {}
return this.splitData[0].orderSplitItemBackVOList.find(item => item.orderItemId == this.orderItem.orderItemId) || {}
if(!this.shopForm.orderItemId) return {}
return this.orderData.orderItemVOList.find(item => item.orderItemId === this.shopForm.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 && split.id == this.splitData[this.splitIndex].id){
return
}
// 每个品名的入仓记录挨个累减其他数据
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),
weight: 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.weight = data.weight.plus(new Decimal(item.weight || 0))
data.quantity = data.quantity.plus(new Decimal(item.quantity || 0))
})
return {
num: data.num.toNumber(),
volume: data.volume.toNumber(),
weight: data.weight.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, splitIndex) => {
split.orderSplitItemBackVOList.forEach(splitItem => {
// 当前正在拆的品名不包含,因为后面shopForm.specsRecordVOList会包含
if(splitIndex == this.splitIndex && splitItem.orderItemId == this.shopForm.orderItemId){
return
}
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: {
......@@ -510,8 +840,6 @@ export default {
this.splitData = response.data.orderSplitBackVOList
this.orderApprovalBackVO = response.data
this.loading = false;
});
},
......@@ -566,47 +894,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
......@@ -617,8 +904,10 @@ export default {
})
},
addShop(index){
this.splitItemIndex = index
this.splitIndex = index
this.shopOpen = true
// 重置表单数据
this.shopForm = {specsRecordVOList:[]}
},
addSplit(){
this.form.transportId = this.orderData.transportId
......@@ -631,22 +920,7 @@ export default {
}
this.open = true
},
changeProdTitleZh(val){
var list = []
list = this.splitData[0].orderSplitItemBackVOList.filter(item=>item.id == val)
this.shopForm.sum = list[0].num
this.quantitySum = list[0].quantity
this.shopForm.orderItemId = list[0].orderItemId
this.shopForm.prodTitleEn = list[0].prodTitleEn
this.shopForm.prodTitleZh = list[0].prodTitleZh
var orderItemData = this.orderData.orderItemVOList.find(item=>item.orderItemId==this.shopForm.orderItemId)
/*var params = {
'seaFreightVolume':orderItemData.seaFreightVolume,
'clearanceFreightVolume':orderItemData.clearanceFreightVolume
}
console.log(orderItemData)*/
this.numcheck()
},
// 查询数量是否必填
numcheck(){
quantityRequired(this.orderData.lineId).then(res=>{
this.quantityshow = res.data
......@@ -696,36 +970,66 @@ export default {
})
that.open = false
},
cancel(){
/*cancel(){
this.open = false
this.form = {}
},
},*/
shopAdd(){
this.$refs["shopForm"].validate(valid => {
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}`
})
var params = {
num:this.shopForm.num,
num:this.putin.num,
orderItemId:this.shopForm.orderItemId,
orderSplitId:this.splitData[this.splitItemIndex].id,
orderSplitId:this.splitData[this.splitIndex].id,
remark:this.shopForm.remark,
volume: this.shopForm.volume,
volume: this.putin.volume,
chargeVolume: this.shopForm.chargeVolume,
weight: this.shopForm.weight,
weight: this.putin.weight,
quantity: this.putin.quantity,
chargeWeight: this.shopForm.chargeWeight,
worth: this.shopForm.worth
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])
}
createSplitItem(params).then(res=>{
})
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("放入成功"));
this.getList()
await this.getList()
this.shopForm = {}
})
this.shopOpen = false
})
})
},
removeShop(id){
let that = this
......@@ -761,10 +1065,102 @@ export default {
})
})
},
// 删除一行,可选参数index表上行号,参数不是数字则删除最后一行
deleteRow(index){
const spliceIndex = typeof index !== 'number' ? this.shopForm.specsRecordVOList.length - 1 : index
this.shopForm.specsRecordVOList.splice(spliceIndex, 1)
this.calcDefaultData()
},
// 计算体积
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)
this.$set(row, 'chargeVolume', volume)
},
// 显示入库记录
showWarehouse(row){
if(!row.specsRecordVOList){
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
this.calcDefaultData()
},
// 清空放入记录
clearAll(){
this.$confirm(this.$t("确定要清空放入数据么?")).then(res => {
this.shopForm.specsRecordVOList = []
this.calcDefaultData()
})
},
// 计算放入的默认值
calcDefaultData(){
const orderItem = this.orderData.orderItemVOList.find(item => item.orderItemId == this.shopForm.orderItemId)
const rate = this.putin.num / orderItem.warehouseInInfoVO.cartonsNum
/*
* 1 普货 2 重货 3 泡货
* 普货 收费数据=入仓数据
* 泡货 收费方数=入仓方数 收费重量 = 品名收费重量*比例
* 重货 收费方数=品名收费方数*比例 收费重量 = 入仓重量
* */
const chargeVolume = orderItem.itemType === 2 ? (orderItem.chargeVolume*rate).toFixed(2) : this.putin.volume
const chargeWeight = orderItem.itemType === 3 ? (orderItem.chargeWeight*rate).toFixed(2) : this.putin.weight
this.$set(this.shopForm, 'chargeVolume', chargeVolume)
this.$set(this.shopForm, 'chargeWeight', chargeWeight)
this.$set(this.shopForm, 'worth', (orderItem.worth*rate).toFixed(2))
},
// 重置
reset(){
return deleteAllSplit(this.queryParams.orderId).then(res => {
this.getList()
})
},
// 取消
async cancel(){
await this.reset()
this.$store.dispatch('tagsView/delCurrentView')
}
}
}
</script>
<style scoped>
.page-title{
margin: 0;
}
.card-title{
font-size: 18px;
font-weight: bold;
......@@ -802,4 +1198,8 @@ export default {
.cancel_content span{
width: 100px;
}
::v-deep .el-form-item--mini.is-error{
margin-bottom: 18px;
}
</style>
......@@ -18,7 +18,12 @@
</el-table-column>
<el-table-column :label="$t('填单货物属性')">
<template v-slot="{row}">
<div>{{$t('品牌')}}:无</div><div>{{$t('箱数')}}{{row.num}}</div><div>{{$t('体积')}}{{ row.volume }}</div><div>{{$t('重量')}}{{row.weight}}Kg</div>
<div>{{$t('品牌')}}{{(brandList.find(item => item.id == row.brand) || {}).titleZh}} <span v-if="!row.brand">
{{$t('')}}
</span> </div>
<div>{{$t('箱数')}}{{row.num}}</div>
<div>{{$t('体积')}}{{ row.volume }}m³</div>
<div>{{$t('重量')}}{{row.weight}}Kg</div>
</template>
</el-table-column>
<el-table-column :label="$t('入库货物属性')">
......@@ -26,13 +31,18 @@
<div v-for="(item,index) in row.orderWarehouseInBackItemDoList" :key="index">
<div>{{$t('规格')}}{{item.boxGauge.split('*').map(item =>`${item}cm`).join('*')}}</div>
<div>
<div>{{$t('品牌')}}{{(brandList.find(item => item.id == row.brand) || {}).titleZh}}</div>
<div>{{$t('品牌')}}{{(brandList.find(item => item.id == row.brand) || {}).titleZh}}
<span v-if="!row.brand">
{{$t('')}}
</span></div>
<div>{{$t('箱数')}}{{item.cartonsNum}}</div>
<div>{{$t('体积')}}{{item.volume}} CMB</div>
<div>{{$t('重量')}}{{item.weight}}KG</div>
</div>
</div>
<p v-if="row.orderWarehouseInBackItemDoList.length === 0">
{{$t('暂无货物入库信息')}}
</p>
</template>
</el-table-column>
<el-table-column :label="$t('最后操作时间')">
......@@ -42,7 +52,7 @@
</el-table-column>
<el-table-column :label="$t('状态')">
<template v-slot="{row}">
{{calculationStatus(row.cartonsNumDiff)}}
{{calculationStatus(row)}}
</template>
</el-table-column>
</el-table>
......@@ -265,13 +275,19 @@ export default {
},
calculationStatus(){
return (val)=>{
if(val > 0){
return `${this.$t('多')}${val}${this.$t('箱')}`
}else if(val < 0){
return `${this.$t('少')}${Math.abs(val)}${this.$t('箱')}`
}else {
return this.$t('准确到齐')
let des = ''
switch (val.diffType) {
case 2 :
des = `${this.$t('多了')}${val.cartonsNumDiff}${this.$t('箱')}`
break
case 3 :
des = `${this.$t('少了')}${val.cartonsNumDiff}${this.$t('箱')}`
break
case 4 :
des = this.$t('准确到齐')
break
}
return des
}
}
},
......@@ -373,11 +389,13 @@ export default {
volume += Number(i.volume)
num += Number(i.num)
weight += Number(i.weight)
if(i.orderWarehouseInBackItemDoList){
i.orderWarehouseInBackItemDoList.forEach(m => {
Wvolume += Number(m.volume || 0)
Wnum += Number(m.cartonsNum || 0)
Wweight += Number(m.weight || 0)
})
}
})
let text = `${this.$t('下单统计')}:${num}${this.$t('箱')} ${volume.toFixed(2)}m³ ${weight.toFixed(2)}Kg`
let text2 =` ${this.$t('入仓统计')}:${Wnum}${this.$t('箱')} ${Wvolume.toFixed(2)}m³ ${Wweight.toFixed(2)}Kg`
......
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