Browse Source

3.海运出口 联调接口 修改单据类型
4.海运进出口 箱号的规则校验

Qukatie 1 month ago
parent
commit
a1ea5bfd38

+ 7 - 0
src/api/iosBasicData/bills.js

@@ -282,3 +282,10 @@ export const updateBatchField = (row) => {
         data: row
     })
 }
+export const updateBillType = (data) => {
+  return request({
+    url: '/api/blade-los/bills/updateBillType',
+    method: 'get',
+    params: data
+  })
+}

+ 27 - 1
src/views/iosBasicData/OceanFreightImport/bills/assembly/DistributionBox/containers.vue

@@ -69,7 +69,8 @@
         <!--</template>-->
         <template slot-scope="scope" slot="cntrNo">
           <el-input v-if="scope.row.edit" v-model="scope.row.cntrNo" maxlength='11' size="small" clearable
-            placeholder="请输入箱号" @input="cntrNoInput(scope.row, 'cntrNo')"></el-input>
+            placeholder="请输入箱号" @input="cntrNoInput(scope.row, 'cntrNo')"
+            @change="verifyChange(scope.row, 'cntrNo')"></el-input>
           <span v-else>{{ scope.row.cntrNo }}</span>
         </template>
         <template slot-scope="scope" slot="sealNo">
@@ -310,6 +311,31 @@ export default {
     cntrNoInput(row, name) {
       this.$set(row, name, row[name].toLocaleUpperCase().replace(/[\W]/g, ''))
     },
+    verifyChange(row, name) {
+      if (name == 'cntrNo') {
+        const regex = /^([a-zA-Z]{4})([0-9]{7})$/;
+        if (regex.test(row[name])) {
+          if (this.calculateCheckDigit(row[name]) == row[name][10]) {
+            this.$message.success('集装箱校验正确!')
+          } else {
+            this.$message.error('集装箱校验不正确!')
+          }
+        } else {
+          this.$set(row, [name], null)
+          this.$message.error('请正确输入4个字母+7个数字!')
+        }
+      }
+    },
+    calculateCheckDigit(containerNo) {
+      let charCode = "0123456789A?BCDEFGHIJK?LMNOPQRSTU?VWXYZ";
+      let num = 0;
+      for (let i = 0; i < 10; i++) {
+        let idx = charCode.indexOf(containerNo[i]);
+        idx = idx * Math.pow(2, i);
+        num += idx;
+      }
+      return num = (num % 11) % 10;
+    },
     uploadBefore(file, done, loading) {
       done();
       loading = true;

+ 18 - 2
src/views/iosBasicData/SeafreightExportF/bills/assembly/DistributionBox/containers.vue

@@ -495,12 +495,28 @@ export default {
         verifyChange(row, name) {
             if (name == 'cntrNo') {
                 const regex = /^([a-zA-Z]{4})([0-9]{7})$/;
-                if (row[name] && !regex.test(row[name])) {
+                if (regex.test(row[name])) {
+                    if (this.calculateCheckDigit(row[name]) == row[name][10]) {
+                        this.$message.success('集装箱校验正确!')
+                    } else {
+                        this.$message.error('集装箱校验不正确!')
+                    }
+                } else {
                     this.$set(row, [name], null)
-                    this.$message.error('请输入4个字母+7个数字!')
+                    this.$message.error('请正确输入4个字母+7个数字!')
                 }
             }
         },
+        calculateCheckDigit(containerNo) {
+            let charCode = "0123456789A?BCDEFGHIJK?LMNOPQRSTU?VWXYZ";
+            let num = 0;
+            for (let i = 0; i < 10; i++) {
+                let idx = charCode.indexOf(containerNo[i]);
+                idx = idx * Math.pow(2, i);
+                num += idx;
+            }
+            return num = (num % 11) % 10;
+        },
         oepnexcelBox() {
             if (!this.assemblyForm.id) {
                 this.$message({

+ 92 - 13
src/views/iosBasicData/SeafreightExportF/bills/index.vue

@@ -318,6 +318,8 @@
                     </el-button>
                     <el-button type="primary" size="small" plain @click="CopyDocumentsfun">复制单据
                     </el-button>
+                    <el-button type="primary" size="small" @click="allClick('修改单据类型')">修改单据类型
+                    </el-button>
                     <el-button type="success" size="small" plain @click="increaseMawb">分单->主单
                     </el-button>
                     <el-button type="warning" size="small" plain v-if="query.billStatus == 0" @click="Disembarkingfun">退
@@ -352,7 +354,8 @@
                             </el-dropdown-item>
                         </el-dropdown-menu>
                     </el-dropdown>
-                    <el-button type="primary" size="small" @click="updateField" :disabled="selectionList.length === 0">批量更改
+                    <el-button type="primary" size="small" @click="updateField"
+                        :disabled="selectionList.length === 0">批量更改
                     </el-button>
                     <div style="margin-top: 10px">
                         <el-tabs type="card" v-model="query.billStatus" @tab-click="handleClick">
@@ -589,23 +592,24 @@ import {
     billsRemove,
     billsRevokeDisembarking,
     billsSubmit,
-    editypesSendingEdi
+    editypesSendingEdi,
+    updateBillType
 } from "@/api/iosBasicData/bills";
-import {mapGetters} from "vuex";
+import { mapGetters } from "vuex";
 import billsDetails from "@/views/iosBasicData/SeafreightExportF/bills/billsDetails.vue";
 import feesTemplateItems from "@/views/iosBasicData/losbfeestemplate/feesTemplateItems.vue";
 import SplitList from "@/views/iosBasicData/SeafreightExportF/bills/assembly/SplitList.vue";
-import {getWorkDicts} from "@/api/system/dictbiz";
-import {defaultDate} from "@/util/date";
+import { getWorkDicts } from "@/api/system/dictbiz";
+import { defaultDate } from "@/util/date";
 import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
-import {editypesList} from "@/api/iosBasicData/editypes";
-import {getBvesselsList} from "@/api/iosBasicData/bvessels";
-import {getBcorpslistByType} from "@/api/iosBasicData/bcorps";
-import {bportsList} from "@/api/iosBasicData/bports";
-import {blinesList} from "@/api/iosBasicData/blines";
+import { editypesList } from "@/api/iosBasicData/editypes";
+import { getBvesselsList } from "@/api/iosBasicData/bvessels";
+import { getBcorpslistByType } from "@/api/iosBasicData/bcorps";
+import { bportsList } from "@/api/iosBasicData/bports";
+import { blinesList } from "@/api/iosBasicData/blines";
 import TreeSelect from "@/components/iosbasic-data/TreeSelect.vue";
-import {getDeptTree} from "@/api/system/dept";
-import {getToken} from "@/util/auth";
+import { getDeptTree } from "@/api/system/dept";
+import { getToken } from "@/util/auth";
 import UpdateBatchField from "@/views/iosBasicData/SeafreightExportF/bills/updateBatchField.vue";
 
 export default {
@@ -1712,7 +1716,7 @@ export default {
     },
     methods: {
 
-        updateField(){
+        updateField() {
             this.$refs.updateFieldRef.formData.ids = this.selectionList.map(item => item.id)
             this.$refs.updateFieldRef.dialogVisible = true
         },
@@ -2085,6 +2089,81 @@ export default {
             this.isShow = false;
             this.$store.commit("IN_SEAFE_DETAIL");
         },
+        allClick(name) {
+            if (name == '修改单据类型') {
+                if (this.selectionList.length !== 1) {
+                    this.$message.warning("请选择一条数据");
+                    return;
+                }
+                for (let item of this.selectionList) {
+                    if (item.status != 0) {
+                        return this.$message.error("请选择未审核的单据");
+                    }
+                }
+                this.$DialogForm.show({
+                    title: "修改单据类型",
+                    width: "300px",
+                    menuPosition: "right",
+                    option: {
+                        submitText: "确认",
+                        emptyText: "取消",
+                        span: 24,
+                        column: [
+                            {
+                                label: "单据类型",
+                                prop: "billType",
+                                type: 'select',
+                                dicData: [
+                                    {
+                                        label: "直单",
+                                        value: "DD"
+                                    },
+                                    {
+                                        label: "主单",
+                                        value: "MM"
+                                    },
+                                    {
+                                        label: "分单",
+                                        value: "MH"
+                                    }
+                                ],
+                                span: 24
+                            }
+                        ]
+                    },
+                    beforeClose: done => {
+                        done();
+                    },
+                    callback: res => {
+                        res.done();
+                        // this.detailData.seeDisabled = false;
+                        // this.detailData.id = this.selectionList[0].id;
+                        // this.isShow = false;
+                        let obj = {
+                            ids: this.selectionList[0].id,
+                            billType: res.data.billType
+                        }
+                        updateBillType(obj).then(res => {
+                            this.refreshChange()
+                            this.$message({
+                                type: "success",
+                                message: "操作成功!"
+                            });
+                        })
+                        // this.$nextTick(() => {
+                        //     this.$refs.billsDetails.pageLoading = true;
+                        //     this.$refs.billsDetails.billsCopyBillsfun(
+                        //         this.selectionList[0].id,
+                        //         res.data.checkbox
+                        //     );
+                        // });
+                        // this.$store.commit("IN_SEAFE_DETAIL");
+                        res.close();
+                    }
+                });
+            }
+
+        },
         // 复制单据
         CopyDocumentsfun() {
             if (this.selectionList.length !== 1) {