md
This commit is contained in:
parent
0277677c84
commit
4f18834ef9
@ -334,8 +334,9 @@ export default {
|
||||
let feeItemList=[];
|
||||
let feeItemPrice=new Map();
|
||||
let errorInfo='';
|
||||
let batchNo=element['批次号'];
|
||||
let batchNo=null;
|
||||
|
||||
// 费用处理
|
||||
for (const key in element) {
|
||||
if (element.hasOwnProperty(key)) {
|
||||
// console.log(`${key}: ${element[key]}`);
|
||||
@ -391,6 +392,49 @@ export default {
|
||||
this.$set(orderData,"feeItemList",feeItemList) ;
|
||||
}
|
||||
|
||||
|
||||
// 判断供应商是否存在
|
||||
let supplierCode=null;
|
||||
// 通过供应商名称找到供应商编号,必须完全匹配
|
||||
let resSuppler= await getSupplierByName(orderData['供应商名称']);
|
||||
if(resSuppler&&resSuppler.code==200){
|
||||
let supplier = resSuppler.data;
|
||||
if(supplier==null){
|
||||
orderData.uploadStatus=-1;
|
||||
orderData.errorInfo='供应商不存在';
|
||||
}else{
|
||||
supplierCode=supplier.code
|
||||
this.$set(orderData,"supplierCode",supplierCode) ;
|
||||
}
|
||||
}else{
|
||||
orderData.uploadStatus=-1;
|
||||
orderData.errorInfo='供应商不存在';
|
||||
}
|
||||
|
||||
if(orderData.uploadStatus!=-1){
|
||||
// 判断批次是否存在 获取批次信息
|
||||
let carNo=orderData['运输单号'];
|
||||
let resBatch=await listBySupplerAndCarNo(supplierCode,carNo);
|
||||
if(resBatch&&resBatch.code==200){
|
||||
if(resBatch.rows&&resBatch.rows.length==0){
|
||||
orderData.uploadStatus=-1;
|
||||
orderData.errorInfo='批次不存在';
|
||||
}
|
||||
else if(resBatch.rows&&resBatch.rows.length>1){
|
||||
orderData.uploadStatus=-1;
|
||||
orderData.errorInfo='存在多个批次';
|
||||
}
|
||||
else{
|
||||
let batchItem=resBatch.rows[0];
|
||||
this.$set(orderData,"batchItem",batchItem) ;
|
||||
this.$set(orderData,"batchNo",batchItem.batchNo) ;
|
||||
}
|
||||
}else{
|
||||
orderData.uploadStatus=-1;
|
||||
orderData.errorInfo='获取批次异常';
|
||||
}
|
||||
}
|
||||
|
||||
// console.log("===orderData=>",orderData)
|
||||
this.tmpDataList.push(orderData);
|
||||
|
||||
@ -410,6 +454,12 @@ export default {
|
||||
}).then(async () => {
|
||||
|
||||
if(this.selectionList&&this.selectionList.length>0){
|
||||
|
||||
|
||||
let loadingInstance = this.$loading({
|
||||
text: '正在批量提交...'
|
||||
})
|
||||
|
||||
for(let i=0;i<this.selectionList.length;i++){
|
||||
let orderItem=this.selectionList[i];
|
||||
|
||||
@ -454,42 +504,16 @@ export default {
|
||||
submitOrderForm.splitType="1";
|
||||
|
||||
try{
|
||||
|
||||
let supplierCode=null;
|
||||
// 通过供应商名称找到供应商编号,必须完全匹配
|
||||
let resSuppler= await getSupplierByName(orderItem['供应商名称']);
|
||||
if(resSuppler&&resSuppler.code==200){
|
||||
let supplier = resSuppler.data;
|
||||
if(supplier==null){
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo='供应商不存在';
|
||||
continue;
|
||||
}
|
||||
supplierCode=supplier.code;
|
||||
}else{
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo='供应商不存在';
|
||||
continue;
|
||||
}
|
||||
|
||||
let batchNo=null;
|
||||
|
||||
console.log("===>orderItem===>",orderItem);
|
||||
|
||||
// 获取批次信息
|
||||
let carNo=orderItem['运输单号'];
|
||||
let resBatch=await listBySupplerAndCarNo(supplierCode,carNo);
|
||||
if(resBatch&&resBatch.code==200){
|
||||
if(resBatch.rows&&resBatch.rows.length==0){
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo='批次不存在';
|
||||
continue;
|
||||
}
|
||||
let batchItem=orderItem['batchItem'];
|
||||
console.log("===>batchItem===>",batchItem);
|
||||
|
||||
if(resBatch.rows&&resBatch.rows.length>1){
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo='存在多个批次';
|
||||
continue;
|
||||
}
|
||||
if(batchItem!=null){
|
||||
|
||||
let batchItem=resBatch.rows[0];
|
||||
batchNo=batchItem.batchNo;
|
||||
|
||||
submitOrderForm.batchNo=batchNo;
|
||||
@ -525,32 +549,38 @@ export default {
|
||||
}
|
||||
}
|
||||
this.$set(submitOrderForm,"billRelList",billRelList)
|
||||
|
||||
console.log("===>submitOrderForm===>",submitOrderForm);
|
||||
|
||||
let res=await draftSubmitTmsCostFee(submitOrderForm)
|
||||
let rstData=res.data;
|
||||
if(rstData.result=='success'){
|
||||
orderItem.uploadStatus=1;
|
||||
orderItem.errorInfo="上传成功";
|
||||
}
|
||||
else{
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo=rstData.msg;
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo='批次不存在';
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
}catch(e){
|
||||
console.log("===>e===>",e,e.message);
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo=''+e.message;
|
||||
continue;
|
||||
}
|
||||
|
||||
let res=await draftSubmitTmsCostFee(submitOrderForm)
|
||||
let rstData=res.data;
|
||||
if(rstData.result=='success'){
|
||||
orderItem.uploadStatus=1;
|
||||
orderItem.errorInfo="上传成功";
|
||||
}
|
||||
else{
|
||||
orderItem.uploadStatus=-1;
|
||||
orderItem.errorInfo=rstData.msg;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
this.$modal.msgSuccess("上传成功");
|
||||
|
||||
loadingInstance.close();
|
||||
this.$modal.msgSuccess("已处理");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user