合包管理页开发完成;运单寄件上传和运单签收图片上传页面新增运单号校验逻辑;

This commit is contained in:
liuyp 2024-05-30 16:24:07 +08:00
parent 0a66a14821
commit a5bd7c879e
3 changed files with 157 additions and 59 deletions

View File

@ -62,7 +62,7 @@
v-hasPermi="['emis:emisTmsPack:add']" v-hasPermi="['emis:emisTmsPack:add']"
>新增合包</el-button> >新增合包</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <!-- <el-col :span="1.5">
<el-button <el-button
type="success" type="success"
plain plain
@ -72,7 +72,7 @@
@click="handleAdd" @click="handleAdd"
v-hasPermi="['emis:emisTmsPack:edit']" v-hasPermi="['emis:emisTmsPack:edit']"
>修改</el-button> >修改</el-button>
</el-col> </el-col> -->
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
@ -80,7 +80,7 @@
icon="el-icon-delete" icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleAdd" @click="handleDeleteCoPack"
v-hasPermi="['emis:emisTmsPack:remove']" v-hasPermi="['emis:emisTmsPack:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
@ -164,7 +164,7 @@
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
@click="handleDelete(scope.row)" @click="CoPack(scope.row)"
v-hasPermi="['emis:emisTmsPack:remove']" v-hasPermi="['emis:emisTmsPack:remove']"
>删除</el-button> --> >删除</el-button> -->
</template> </template>
@ -532,6 +532,12 @@ export default {
tempCoPackList:[], tempCoPackList:[],
coSelection:[], coSelection:[],
//区分当前是新增还是修改
coPackType:'',
// 临时存储已有合包的运单号
tempExistCoPackWayBillList:[],
tempCoPackInfo:{},
// 弹出展示层 // 弹出展示层
id:null, id:null,
@ -574,6 +580,7 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
// this.queryParams.params = {}; // this.queryParams.params = {};
this.emisTmsPackList = [];
if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) { if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0]; this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1]; this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
@ -632,6 +639,7 @@ export default {
packName: this.coData.packName || '', packName: this.coData.packName || '',
packDate: this.coData.createTime, packDate: this.coData.createTime,
destCountry: this.coData.destCountry, destCountry: this.coData.destCountry,
nextSiteCode: this.coData.nextSiteCode,
// destCountryName: this.coData., // destCountryName: this.coData.,
blUnpack: this.coData.blUnpack, blUnpack: this.coData.blUnpack,
sendStiteCode: this.coData.sendStiteCode, sendStiteCode: this.coData.sendStiteCode,
@ -642,6 +650,7 @@ export default {
// packStatus: this.coData., // packStatus: this.coData.,
opMan: this.$store.getters.empCode opMan: this.$store.getters.empCode
} }
if(this.coPackType == "add"){// 新增
addEmisTmsPack(coPackItem).then(response => { addEmisTmsPack(coPackItem).then(response => {
if(!response || response.code != 200){ if(!response || response.code != 200){
this.$modal.msgError(response && response.msg || '新增合包失败') this.$modal.msgError(response && response.msg || '新增合包失败')
@ -666,10 +675,101 @@ export default {
} }
}) })
} }
}else if(this.coPackType == "edit"){// 修改
//第一步:处理合包信息的更新;
if(this.tempCoPackInfo.destCountry != this.coData.destCountry
|| this.tempCoPackInfo.sendStiteCode != this.coData.sendStiteCode
|| 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.totalWeight != this.coData.totalWeight
|| this.tempCoPackInfo.totalVolume != this.coData.totalVolume
){
this.tempCoPackInfo.destCountry = this.coData.destCountry;
this.tempCoPackInfo.sendStiteCode = this.coData.sendStiteCode;
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.totalWeight = this.coData.totalWeight;
this.tempCoPackInfo.totalVolume = this.coData.totalVolume;
updateEmisTmsPack(this.tempCoPackInfo).then(res => {
if(!res || res.code != 200){
this.$modal.msgError(res && res.msg || '未知错误')
return;
}
});
}
//第二步:处理运单列表的数据
let tempDelList = [];
let tempAddList=[];
//2.1:计算要删除的运单
tempDelList = this.tempExistCoPackWayBillList.filter(item => {
let ls = this.emisCoPackDetail.filter(cd => {
return cd.billCode == item.billCode
})
if(ls.length > 0){
return false;
}else{
return true;
}
})
tempDelList.forEach(item =>{
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 => {
return cd.billCode == item.billCode
})
if(ls.length > 0){
return false;
}else{
return true;
}
})
tempAddList.forEach(item =>{
let packDetail = {
packNo:this.coData.packNo,
billCode: item.billCode,
scanDate: item.scanDate,
scanStatus: item.scanStatus,
packStatus: null,
scanMan: item.scanMan,
createBy: this.$store.getters.empCode,
createTime: parseTime(new Date())
};
addEmisTmsPackDtl(packDetail).then(response => {
if(!response || response.code != 200){
this.$modal.msgError(response && response.msg || '合包明细新增失败')
return;
}
})
})
}
this.openForm= false; this.openForm= false;
this.titleForm = ""; this.titleForm = "";
this.$modal.msgSuccess('操作成功!'); this.$modal.msgSuccess('操作成功!');
this.getList();
},
async handleDeleteCoPack(){
let that =this;
for(let i = 0; i< this.ids.length;i++){
let res = await delEmisTmsPack(this.ids[i]);
if(!res || res.code != 200){
that.$modal.msgError(res && res.msg || '合包删除失败')
that.getList();
return;
}
}
this.$modal.msgSuccess('操作成功');
this.getList();
}, },
handleCancelCo(){ handleCancelCo(){
this.titleForm=''; this.titleForm='';
@ -733,6 +833,7 @@ export default {
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.selection = selection;
this.single = selection.length!==1 this.single = selection.length!==1
this.multiple = !selection.length this.multiple = !selection.length
}, },
@ -768,7 +869,10 @@ export default {
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
async handleAdd() { async handleAdd() {
this.coPackType="add";
this.coData = {}; this.coData = {};
this.tempExistCoPackWayBillList = [];//情况临时保存的已有运单号
this.tempCoPackInfo={};
let response = await getPackNo(); let response = await getPackNo();
if(!response || response.code != 200){ if(!response || response.code != 200){
this.$message.error(response && response.msg || "未知错误"); this.$message.error(response && response.msg || "未知错误");
@ -796,12 +900,12 @@ export default {
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
async handleUpdate(row) { async handleUpdate(row) {
this.coPackType="edit";
let response = await getEmisTmsPack(row.id); let response = await getEmisTmsPack(row.id);
if(!response || response.code != 200){ if(!response || response.code != 200){
this.$message.error(response && response.msg || "未知错误"); this.$message.error(response && response.msg || "未知错误");
return; return;
} }
debugger;
let resData = response.data; let resData = response.data;
this.coData.packNo = resData.packNo; this.coData.packNo = resData.packNo;
this.coData.createTime = resData.createTime; this.coData.createTime = resData.createTime;
@ -818,7 +922,8 @@ export default {
this.$message.error(resList && resList.msg || "未知错误"); this.$message.error(resList && resList.msg || "未知错误");
return; return;
} }
debugger; this.tempExistCoPackWayBillList = resList.rows;//临时存储,用于运单号校验
this.tempCoPackInfo = resData;
for(let p = 0; p < resList.rows.length;p++){ for(let p = 0; p < resList.rows.length;p++){
let resd = await getWaybillDetail(resList.rows[p].billCode); let resd = await getWaybillDetail(resList.rows[p].billCode);
if(!resd || resd.code != 200){ if(!resd || resd.code != 200){
@ -846,7 +951,7 @@ export default {
this.openForm = false; this.openForm = false;
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { CoPack(row) {
const ids = row.id || this.ids; const ids = row.id || this.ids;
this.$modal.confirm('是否确认删除').then(function() { this.$modal.confirm('是否确认删除').then(function() {
return delEmisTmsPack(ids); return delEmisTmsPack(ids);

View File

@ -62,6 +62,7 @@
<script> <script>
import { addEmisWaybillAttachment } from "@/api/emis/emisWaybillAttachment"; import { addEmisWaybillAttachment } from "@/api/emis/emisWaybillAttachment";
import { getWaybillDetail } from "@/api/emis/emisWaybill";
import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker'; import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
import emisWaybillView from '@/views/emis/emisWaybill/emisWaybillView'; import emisWaybillView from '@/views/emis/emisWaybill/emisWaybillView';
import emisWaybillForm from '@/views/emis/emisWaybill/emisWaybillForm'; import emisWaybillForm from '@/views/emis/emisWaybill/emisWaybillForm';
@ -121,17 +122,23 @@ export default {
getList(){ getList(){
}, },
handleInput(item, size){ async handleInput(item, size){
if(item.trim() == ""){ if(item.trim() == ""){
return; return;
} }
let scList = item.trim().split(/[;\;\,\,\n]/)||[]; let scList = item.trim().split(/[;\;\,\,\n]/)||[];
scList.forEach(item=>{ this.form.picUrl =[];
for(let s = 0; s<scList.length; s++){
let billCode = this.extractSubstring(item); let billCode = this.extractSubstring(item);
if(this.dataMap[billCode]) return; if(this.dataMap[billCode]) return;
let response = await getWaybillDetail(billCode)
if(!response || response.code != 200){
this.$modal.msgError(response && response.msg || "未知错误");
return;
}
let record = {}; let record = {};
record.billCode=billCode; record.billCode=billCode;
record.fileUrl=item; record.fileUrl=scList[s];
record.createSiteCode=this.$store.getters.ownerSiteCode; record.createSiteCode=this.$store.getters.ownerSiteCode;
record.createSite=this.$store.getters.ownerSiteName; record.createSite=this.$store.getters.ownerSiteName;
record.createBy=this.$store.getters.empName; record.createBy=this.$store.getters.empName;
@ -150,18 +157,8 @@ export default {
let indexBillCode=billCode; let indexBillCode=billCode;
this.dataMap[indexBillCode]=record; this.dataMap[indexBillCode]=record;
this.emisTmsScanRecordList.push(record); this.emisTmsScanRecordList.push(record);
// getWaybillDetail(billCode).then(response => { };
// debugger; // this.form.picUrl =[];
// if(!response || response.code != 200){
// this.$modal.msgError(response && response.msg || "未知错误");
// return;
// }
// })
});
// this.$refs.imageUpload.fileList = [];
this.form.picUrl =[];
}, },
/** 上传按钮操作 */ /** 上传按钮操作 */
handleScanUpload(){ handleScanUpload(){

View File

@ -62,6 +62,7 @@
<script> <script>
import { addEmisWaybillAttachment } from "@/api/emis/emisWaybillAttachment"; import { addEmisWaybillAttachment } from "@/api/emis/emisWaybillAttachment";
import { getWaybillDetail } from "@/api/emis/emisWaybill";
import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker'; import elDateSimplePicker from '@/components/DatePickerAdv/elDateSimplePicker';
import emisWaybillView from '@/views/emis/emisWaybill/emisWaybillView'; import emisWaybillView from '@/views/emis/emisWaybill/emisWaybillView';
import emisWaybillForm from '@/views/emis/emisWaybill/emisWaybillForm'; import emisWaybillForm from '@/views/emis/emisWaybill/emisWaybillForm';
@ -121,18 +122,24 @@ export default {
getList(){ getList(){
}, },
handleInput(item, size){ async handleInput(item, size){
if(item.trim() == ""){ if(item.trim() == ""){
return; return;
} }
let scList = item.trim().split(/[;\;\,\,\n]/)||[]; let scList = item.trim().split(/[;\;\,\,\n]/)||[];
scList.forEach(item=>{ this.form.picUrl =[];
let billCode = this.extractSubstring(item); for(let s = 0; s<scList.length; s++){
let billCode = this.extractSubstring(scList[s]);
if(this.dataMap[billCode]) return; if(this.dataMap[billCode]) return;
let response = await getWaybillDetail(billCode)
if(!response || response.code != 200){
this.$modal.msgError(response && response.msg || "未知错误");
this.form.picUrl =[];
return;
}
let record = {}; let record = {};
record.billCode=billCode; record.billCode=billCode;
record.fileUrl=item; record.fileUrl=scList[s];
// record.createSiteCode=this.$store.getters.ownerSiteCode;
record.createSite=this.$store.getters.ownerSiteName; record.createSite=this.$store.getters.ownerSiteName;
record.createBy=this.$store.getters.empName; record.createBy=this.$store.getters.empName;
record.signManCode=this.$store.getters.empCode; record.signManCode=this.$store.getters.empCode;
@ -150,18 +157,7 @@ export default {
let indexBillCode=billCode; let indexBillCode=billCode;
this.dataMap[indexBillCode]=record; this.dataMap[indexBillCode]=record;
this.emisTmsScanRecordList.push(record); this.emisTmsScanRecordList.push(record);
// getWaybillDetail(billCode).then(response => { };
// debugger;
// if(!response || response.code != 200){
// this.$modal.msgError(response && response.msg || "未知错误");
// return;
// }
// })
});
// this.$refs.imageUpload.fileList = [];
this.form.picUrl =[];
}, },
/** 上传按钮操作 */ /** 上传按钮操作 */
handleScanUpload(){ handleScanUpload(){