修复合包管理的bug

This commit is contained in:
liuyp 2024-06-01 20:48:42 +08:00
parent 851ce3cd72
commit d3a90abaa6

View File

@ -136,13 +136,22 @@
-->
<el-table-column :label="$t('合包号')" align="center" prop="packNo" min-width="100" />
<el-table-column :label="$t('合包状态')" align="center" prop="packStatus" min-width="100" />
<el-table-column :label="$t('合包状态')" align="center" prop="packStatus" min-width="100">
<template slot-scope="scope">
<dict-tag :options="dict.type.emis_pack_status" :value="scope.row.packStatus"/>
</template>
</el-table-column>
<el-table-column :label="$t('操作网点')" align="center" prop="sendStiteCode" min-width="100" />
<el-table-column :label="$t('是否可拆')" align="center" prop="blUnpack" min-width="100" />
<el-table-column :label="$t('是否可拆')" align="center" prop="blUnpack" min-width="100">
<template slot-scope="scope">
<span>{{ scope.row.blUnpack == "1" ? "是" : "否" }}</span>
</template>
</el-table-column>
<el-table-column :label="$t('操作员')" align="center" prop="opMan" min-width="100" />
<el-table-column :label="$t('票数')" align="center" prop="totalWaybillQty" min-width="100" />
<el-table-column :label="$t('件数')" align="center" prop="totalParcelQty" min-width="100" />
<el-table-column :label="$t('实际重量')" align="center" prop="totalWeight" min-width="100" />
<el-table-column :label="$t('体积')" align="center" prop="totalVolume" min-width="100" />
<el-table-column :label="$t('创建时间')" align="center" prop="packDate" min-width="100" />
<el-table-column :label="$t('操作')" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
@ -235,12 +244,12 @@
</el-col>
<el-col :span="24">
<el-form-item style="font-weight:600;">
<span>{{$t('总件数') + ': ' + (coData.parcelQty || 0)}}</span>
<span>{{$t('总件数') + ': ' + (coData.totalParcelQty || 0)}}</span>
</el-form-item>
<!-- <el-form-item>
<span slot="label">
<span style="font-weight:600">{{$t('总件数') + ': '}}</span>
<span style="font-weight:600">{{coData.parcelQty || 0}}</span>
<span style="font-weight:600">{{coData.totalParcelQty || 0}}</span>
</span>
</el-form-item> -->
</el-col>
@ -480,8 +489,7 @@ import { parseTime } from "@/utils/custom";
export default {
name: "PackageManagement",
components: { CountryPicker, EmisSiteSimplePicker, elDateAdvPicker, emisTmsPackForm, TransLinePicker, TransProductPicker},
dicts: [
],
dicts: ['emis_pack_status'],
data() {
return {
// 遮罩层
@ -625,7 +633,7 @@ export default {
console.log("date picker---->", value)
this.wayBillData.dateTimeRange=value;
},
handleAddCoPack(){
async handleAddCoPack(){
if(!this.coData.destCountry || !this.coData.sendStiteCode || !this.coData.nextSiteCode || !this.blUnpack){
this.$modal.msgError("请先选择必填项")
return;
@ -651,12 +659,13 @@ export default {
opMan: this.$store.getters.empCode
}
if(this.coPackType == "add"){// 新增
addEmisTmsPack(coPackItem).then(response => {
let response = await addEmisTmsPack(coPackItem);
// addEmisTmsPack(coPackItem).then(response => {
if(!response || response.code != 200){
this.$modal.msgError(response && response.msg || '新增合包失败')
return;
}
})
// })
for(let i = 0; i< this.emisCoPackDetail.length;i++){
let packDetail = {
packNo:this.coData.packNo,
@ -668,12 +677,13 @@ export default {
createBy: this.$store.getters.empCode,
createTime: parseTime(new Date())
};
addEmisTmsPackDtl(packDetail).then(response => {
let response = await addEmisTmsPackDtl(packDetail);
// addEmisTmsPackDtl(packDetail).then(response => {
if(!response || response.code != 200){
this.$modal.msgError(response && response.msg || '合包明细新增失败')
return;
}
})
// })
}
}else if(this.coPackType == "edit"){// 修改
//第一步:处理合包信息的更新;
@ -682,7 +692,7 @@ export default {
|| this.tempCoPackInfo.nextSiteCode != this.coData.nextSiteCode
|| this.tempCoPackInfo.blUnpack != this.blUnpack
|| this.tempCoPackInfo.totalWaybillQty != this.coData.totalWaybillQty
|| this.tempCoPackInfo.parcelQty != this.coData.parcelQty
|| this.tempCoPackInfo.totalParcelQty != this.coData.totalParcelQty
|| this.tempCoPackInfo.totalWeight != this.coData.totalWeight
|| this.tempCoPackInfo.totalVolume != this.coData.totalVolume
){
@ -691,15 +701,16 @@ export default {
this.tempCoPackInfo.nextSiteCode = this.coData.nextSiteCode;
this.tempCoPackInfo.blUnpack = this.blUnpack;
this.tempCoPackInfo.totalWaybillQty = this.coData.totalWaybillQty;
this.tempCoPackInfo.parcelQty = this.coData.parcelQty;
this.tempCoPackInfo.totalParcelQty = this.coData.totalParcelQty;
this.tempCoPackInfo.totalWeight = this.coData.totalWeight;
this.tempCoPackInfo.totalVolume = this.coData.totalVolume;
updateEmisTmsPack(this.tempCoPackInfo).then(res => {
let res = await updateEmisTmsPack(this.tempCoPackInfo);
// updateEmisTmsPack(this.tempCoPackInfo).then(res => {
if(!res || res.code != 200){
this.$modal.msgError(res && res.msg || '未知错误')
return;
}
});
// });
}
//第二步:处理运单列表的数据
let tempDelList = [];
@ -715,14 +726,18 @@ export default {
return true;
}
})
tempDelList.forEach(item =>{
delEmisTmsPackDtl(item.id).then(res => {
// tempDelList.forEach(item =>{
for(let tdl = 0; tdl < tempDelList.length; tdl++){
let item = tempDelList[tdl];
let res = await delEmisTmsPackDtl(item.id);
// delEmisTmsPackDtl(item.id).then(res => {
if(!res || res.code != 200){
this.$modal.msgError(res && res.msg || '未知错误')
return;
}
})
})
// })
}
// })
//2.2:计算要新增的运单
tempAddList = this.emisCoPackDetail.filter(item => {
let ls = this.tempExistCoPackWayBillList.filter(cd => {
@ -734,7 +749,9 @@ export default {
return true;
}
})
tempAddList.forEach(item =>{
// tempAddList.forEach(item =>{
for(let tal = 0; tal < tempAddList.length; tal++){
let item = tempAddList[tal];
let packDetail = {
packNo:this.coData.packNo,
billCode: item.billCode,
@ -745,13 +762,15 @@ export default {
createBy: this.$store.getters.empCode,
createTime: parseTime(new Date())
};
addEmisTmsPackDtl(packDetail).then(response => {
let response = await addEmisTmsPackDtl(packDetail);
// addEmisTmsPackDtl(packDetail).then(response => {
if(!response || response.code != 200){
this.$modal.msgError(response && response.msg || '合包明细新增失败')
return;
}
})
})
// })
}
// })
}
this.openForm= false;
this.titleForm = "";
@ -844,12 +863,12 @@ export default {
this.coMultiple = !selection.length
},
computeTotal(){
let parcelQty=0;
let totalParcelQty=0;
let totalWeight=0;
let totalVolume=0;
this.emisCoPackDetail.forEach(item =>{
parcelQty +=item.parcelQty;
totalWeight +=item.totalWeight;
totalParcelQty +=item.parcelQty;
totalWeight +=item.billWeight;
totalVolume +=item.totalVolume;
item.destCountry = this.coData.destCountry;
item.sendStiteCode = this.coData.sendStiteCode;
@ -857,7 +876,7 @@ export default {
item.blUnpack = this.blUnpack;
})
this.coData.totalWaybillQty=this.emisCoPackDetail.length;
this.coData.parcelQty=parcelQty;
this.coData.totalParcelQty=totalParcelQty;
this.coData.totalWeight=totalWeight;
this.coData.totalVolume=totalVolume;
},