作者 shenhailong

快邮舱单申报 主分单报文发送追加

1 import axios from 'axios' 1 import axios from 'axios'
2 import http from "../http"; 2 import http from "../http";
3 3
4 -let baseUrl = 'express-system/express' 4 +let awbaUrl = 'express-system/expressAwba'
  5 +let awbhUrl = 'express-system/expressAwbh'
  6 +let bulidMsg = 'express-system/bulidMsg'
5 7
6 8
  9 +/**
  10 + * 主单请求
  11 + * @param params
  12 + * @returns {Promise<AxiosResponse<T>>}
  13 + */
  14 +export const getExpressList = params => { return axios.get(`${awbaUrl}/list`, { params: params });};
7 15
8 -export const getExpressList = params => { return axios.get(`${baseUrl}/list`, { params: params }); }; 16 +export const awbaAdd = params => { return http.post(`${awbaUrl}/awbaAdd`,params)};
9 17
10 -export const awbaAdd = params => { return http.post(`${baseUrl}/awbaAdd`,params)}; 18 +export const awbaEdit = params => { return http.put(`${awbaUrl}/awbaEdit`,params)};
11 19
12 -export const awbaEdit = params => { return http.put(`${baseUrl}/awbaEdit`,params)}; 20 +export const selectAwba = params => { return http.get(`${awbaUrl}/selectAwba`,{ params: params });};
13 21
14 -export const awbhAdd = params => { return http.post(`${baseUrl}/awbhAdd`,params)}; 22 +/**
  23 + * 分单请求
  24 + */
  25 +export const awbhAdd = params => { return http.post(`${awbhUrl}/awbhAdd`,params)};
  26 +
  27 +export const awbhEdit = params => { return http.put(`${awbhUrl}/awbhEdit`,params)};
  28 +
  29 +export const selectAwbh = params => { return axios.get(`${awbhUrl}/selectAwbh`, { params: params }); };
  30 +
  31 +/**
  32 + * 生成报文
  33 + */
  34 +export const awbaAddBulid = params => { return http.post(`${bulidMsg}/awbaAddBulid`,params)};
  35 +
  36 +export const awbhAddBulid = params => { return http.post(`${bulidMsg}/awbhAddBulid`,params)};
15 37
16 -export const awbhEdit = params => { return http.put(`${baseUrl}/awbhEdit`,params)};  
17 38
@@ -37,31 +37,41 @@ @@ -37,31 +37,41 @@
37 @selection-change="handleSelectionChange"> 37 @selection-change="handleSelectionChange">
38 <el-table-column type="selection" width="55"> 38 <el-table-column type="selection" width="55">
39 </el-table-column> 39 </el-table-column>
40 - <el-table-column prop="billno" label="主单号" width="180"> 40 + <el-table-column prop="billno" label="主单号" width="170px">
41 </el-table-column> 41 </el-table-column>
42 - <el-table-column prop="assbillno" label="分单号" width="180"> 42 + <el-table-column prop="assbillno" label="分单号" width="110px">
43 </el-table-column> 43 </el-table-column>
44 - <el-table-column prop="flightNo" label="航班号" width="180"> 44 + <el-table-column prop="flightNo" label="航班号" width="75px">
45 </el-table-column> 45 </el-table-column>
46 - <el-table-column prop="flightDate" label="航班日期" width="180"> 46 + <el-table-column prop="flightDate" label="航班日期" width="110px">
47 </el-table-column> 47 </el-table-column>
48 - <el-table-column prop="maingname" label="分单主商品名称" width="180"> 48 +<!-- <el-table-column prop="maingname" label="分单主商品名称" width="180px">-->
  49 +<!-- </el-table-column>-->
  50 + <el-table-column prop="ieflag" :formatter="ieflagType" label="进出口标识" width="100px">
49 </el-table-column> 51 </el-table-column>
50 - <el-table-column prop="ieflag" label="进出口标识" width="100px"> 52 + <el-table-column prop="grosswt" label="毛重" width="100px">
51 </el-table-column> 53 </el-table-column>
52 - <el-table-column prop="grosswt" label="毛重">  
53 - </el-table-column>  
54 - <el-table-column prop="packno" label="件数"> 54 + <el-table-column prop="packno" label="件数" width="100px">
55 </el-table-column> 55 </el-table-column>
56 <el-table-column prop="billnum" label="分运单总数" width="100px"> 56 <el-table-column prop="billnum" label="分运单总数" width="100px">
57 </el-table-column> 57 </el-table-column>
58 <el-table-column prop="iedate" label="进出口日期" width="100px"> 58 <el-table-column prop="iedate" label="进出口日期" width="100px">
59 </el-table-column> 59 </el-table-column>
60 - <el-table-column label="操作" min-width="300px">  
61 - <template slot-scope="scope">  
62 - <el-button type="primary" size="small" v-if="scope.row.ext1 == 'awba'" @click="expressAwbhAdd(scope.$index, scope.row)">新增分单</el-button>  
63 - <el-button type="primary" size="small" v-if="scope.row.ext1 == 'awba'" @click="expressEditAwbaAdd(scope.$index, scope.row)">编辑主单</el-button>  
64 - <el-button type="primary" size="small" v-else @click="expressEditAwbhAdd(scope.$index, scope.row)">编辑分单</el-button> 60 + <el-table-column prop="" label="回执状态" width="100px">
  61 + </el-table-column>
  62 + <el-table-column prop="" label="回执内容" width="180px">
  63 + </el-table-column>
  64 + <el-table-column label="操作" align="center" fixed="right" width="330px">
  65 + <template slot-scope="scope" >
  66 + <el-button type="primary" size="mini" v-if="scope.row.ext1 == 'awba'" @click="expressAwbhAdd(scope.$index, scope.row)">新增分单</el-button>
  67 + <el-button type="primary" size="mini" v-if="scope.row.ext1 == 'awba'" @click="expressEditAwbaAdd(scope.$index, scope.row)">编辑主单</el-button>
  68 + <el-button type="primary" size="mini" v-else @click="expressEditAwbhAdd(scope.$index, scope.row)">编辑分单</el-button>
  69 + <el-button type="primary" size="mini" v-if="scope.row.ext1 == 'awba'" @click="expressBulidAbwa(scope.$index, scope.row)">发送主单报文</el-button>
  70 + <el-button type="primary" size="mini" v-else @click="expressBulidAbwh(scope.$index, scope.row)">发送分单报</el-button>
  71 + <br>
  72 + <br>
  73 + <el-button type="primary" size="mini" v-if="scope.row.ext1 == 'awba'" @click="expressEditBulidAbwa(scope.$index, scope.row)">发送修改主单表头报文</el-button>
  74 + <el-button type="primary" size="mini" v-else @click="expressEditBulidAbwh(scope.$index, scope.row)">发送追加表体分单报</el-button>
65 </template> 75 </template>
66 </el-table-column> 76 </el-table-column>
67 </el-table> 77 </el-table>
@@ -84,7 +94,8 @@ @@ -84,7 +94,8 @@
84 <el-row> 94 <el-row>
85 <el-col :span="8"> 95 <el-col :span="8">
86 <el-form-item label="主单号" :label-width="expressAddlWidth" prop="billno"> 96 <el-form-item label="主单号" :label-width="expressAddlWidth" prop="billno">
87 - <el-input style="width: 80%" v-model="expressAwbaAddModel.billno" autocomplete="off"></el-input> 97 + <el-input style="width: 80%" v-if="dialogCommon == 'add'" v-model="expressAwbaAddModel.billno" autocomplete="off"></el-input>
  98 + <el-input style="width: 80%" v-else disabled v-model="expressAwbaAddModel.billno" autocomplete="off"></el-input>
88 </el-form-item> 99 </el-form-item>
89 </el-col> 100 </el-col>
90 <el-col :span="8"> 101 <el-col :span="8">
@@ -282,7 +293,8 @@ @@ -282,7 +293,8 @@
282 </template> 293 </template>
283 294
284 <script> 295 <script>
285 - import {getExpressList, awbaAdd, awbaEdit, awbhAdd, awbhEdit} from '../../api/express/express' 296 + import {getExpressList, awbaAdd, awbaEdit, selectAwba, awbhAdd,
  297 + awbhEdit, selectAwbh, awbaAddBulid, awbhAddBulid} from '../../api/express/express'
286 import loginUserInfo from "../../api/base"; 298 import loginUserInfo from "../../api/base";
287 export default { 299 export default {
288 name: "express", 300 name: "express",
@@ -466,6 +478,13 @@ @@ -466,6 +478,13 @@
466 this.listLoading = false; 478 this.listLoading = false;
467 }); 479 });
468 }, 480 },
  481 + ieflagType: function(row, column){
  482 + if (row.ieflag == 'I'){
  483 + return "进口";
  484 + }else if(row.ieflag == 'E'){
  485 + return "出口";
  486 + }
  487 + },
469 /** 488 /**
470 * 多选单选 489 * 多选单选
471 * @param val 490 * @param val
@@ -501,6 +520,13 @@ @@ -501,6 +520,13 @@
501 this.$refs.expressAwbaAddModel.validate((valid) => { 520 this.$refs.expressAwbaAddModel.validate((valid) => {
502 if (valid) { 521 if (valid) {
503 this.$confirm('确认提交吗?', '提示', {}).then(() => { 522 this.$confirm('确认提交吗?', '提示', {}).then(() => {
  523 + let para = {
  524 + billno: this.expressAwbaAddModel.billno
  525 + }
  526 + this.listLoading = true;
  527 + // 查询主单是否重复
  528 + selectAwba(para).then((res) => {
  529 + if (res.data.code == 200){
504 //NProgress.start(); 530 //NProgress.start();
505 this.listLoading = true; 531 this.listLoading = true;
506 this.expressAwbaAddModel.userName = loginUserInfo.username; 532 this.expressAwbaAddModel.userName = loginUserInfo.username;
@@ -522,6 +548,15 @@ @@ -522,6 +548,15 @@
522 }); 548 });
523 } 549 }
524 }).catch(error => alert(error)); 550 }).catch(error => alert(error));
  551 + }else {
  552 + this.$message({
  553 + message: '此单号已存在,请勿重复添加',
  554 + type: 'error'
  555 + });
  556 + }
  557 + }).catch((error) => {
  558 + this.listLoading = false;
  559 + });
525 }).catch(() =>{ 560 }).catch(() =>{
526 561
527 }); 562 });
@@ -593,6 +628,12 @@ @@ -593,6 +628,12 @@
593 this.$refs.expressAwbhAddModel.validate((valid) => { 628 this.$refs.expressAwbhAddModel.validate((valid) => {
594 if (valid) { 629 if (valid) {
595 this.$confirm('确认提交吗?', '提示', {}).then(() => { 630 this.$confirm('确认提交吗?', '提示', {}).then(() => {
  631 + let para = {
  632 + billno: this.expressAwbhAddModel.billno,
  633 + assbillno: this.expressAwbhAddModel.assbillno
  634 + }
  635 + selectAwbh(para).then((res) => {
  636 + if(res.data.code == 200){
596 //NProgress.start(); 637 //NProgress.start();
597 this.listLoading = true; 638 this.listLoading = true;
598 this.expressAwbhAddModel.userName = loginUserInfo.username; 639 this.expressAwbhAddModel.userName = loginUserInfo.username;
@@ -614,6 +655,16 @@ @@ -614,6 +655,16 @@
614 }); 655 });
615 } 656 }
616 }).catch(error => alert(error)); 657 }).catch(error => alert(error));
  658 + }else {
  659 + this.$message({
  660 + message: "同一主单下分单号不可以重复",
  661 + type: "error"
  662 + });
  663 + }
  664 +
  665 + }).catch((error) => {
  666 + this.listLoading = false;
  667 + });
617 }).catch(() =>{ 668 }).catch(() =>{
618 669
619 }); 670 });
@@ -663,8 +714,110 @@ @@ -663,8 +714,110 @@
663 } 714 }
664 }); 715 });
665 }, 716 },
  717 + /**
  718 + * 发送主单报文
  719 + */
  720 + expressBulidAbwa(index, row){
  721 + this.$confirm('发送主单报该下面所有分单会一起发送确定吗?', '提示', {}).then(() => {
  722 + row.optype = "ADD";
  723 + awbaAddBulid(row).then((res) => {
  724 + if (res.data.code == 200){
  725 + this.$message({
  726 + message: '发送成功',
  727 + type: 'success'
  728 + });
  729 + this.listLoading = true;
  730 + this.getList();
  731 + }else {
  732 + this.$message({
  733 + message: '发送失败',
  734 + type: 'error'
  735 + });
  736 + }
  737 + }).catch(error => alert(error));
666 738
  739 + }).catch((error) => {
  740 + this.listLoading = false;
  741 + });
  742 + },
  743 + /**
  744 + * 追加主单报文
  745 + */
  746 + expressEditBulidAbwa(index, row){
  747 + this.$confirm('发送修改主单报表头该下面所有分单会一起发送确定吗?', '提示', {}).then(() => {
  748 + row.optype = "APD";
  749 + awbaAddBulid(row).then((res) => {
  750 + if (res.data.code == 200){
  751 + this.$message({
  752 + message: '发送成功',
  753 + type: 'success'
  754 + });
  755 + this.listLoading = true;
  756 + this.getList();
  757 + }else {
  758 + this.$message({
  759 + message: '发送失败',
  760 + type: 'error'
  761 + });
  762 + }
  763 + }).catch(error => alert(error));
  764 +
  765 + }).catch((error) => {
  766 + this.listLoading = false;
  767 + });
  768 + },
  769 + /**
  770 + * 发送分单报文
  771 + */
  772 + expressBulidAbwh(index, row){
  773 + this.$confirm('发送分单报文会和主单一起发送?', '提示', {}).then(() => {
  774 + row.ext2 = "ADD";
  775 + awbhAddBulid(row).then((res) => {
  776 + if (res.data.code == 200){
  777 + this.$message({
  778 + message: '发送成功',
  779 + type: 'success'
  780 + });
  781 + this.listLoading = true;
  782 + this.getList();
  783 + }else {
  784 + this.$message({
  785 + message: '发送失败',
  786 + type: 'error'
  787 + });
  788 + }
  789 + }).catch(error => alert(error));
667 790
  791 + }).catch((error) => {
  792 + this.listLoading = false;
  793 + });
  794 + },
  795 + /**
  796 + * 追加分单报文
  797 + */
  798 + expressEditBulidAbwh(index, row){
  799 + this.$confirm('追加分单报文会和主单一起发送?', '提示', {}).then(() => {
  800 + row.ext2 = "APD";
  801 + awbhAddBulid(row).then((res) => {
  802 + if (res.data.code == 200){
  803 + this.$message({
  804 + message: '发送成功',
  805 + type: 'success'
  806 + });
  807 + this.listLoading = true;
  808 + this.getList();
  809 + }else {
  810 + this.$message({
  811 + message: '发送失败',
  812 + type: 'error'
  813 + });
  814 + }
  815 + }).catch(error => alert(error));
  816 +
  817 + }).catch((error) => {
  818 + this.listLoading = false;
  819 + });
  820 + },
668 }, 821 },
669 mounted() { 822 mounted() {
670 this.getList(); 823 this.getList();