Qukatie 5 месяцев назад
Родитель
Сommit
d10795027d

+ 8 - 0
src/api/boxManagement/record/index.js

@@ -43,3 +43,11 @@ export const synchronous = (params) => {
     params: params
   })
 }
+//查询明细
+export const emptyContainerEntryFtp = (params) => {
+  return request({
+    url: '/api/blade-los/ftp/emptyContainerEntryFtp',
+    method: 'get',
+    params: params
+  })
+}

+ 3 - 3
src/views/boxManagement/boxPoolDynamics/index.vue

@@ -13,10 +13,10 @@
 
             <el-button v-if="roleName.includes('admin') || roleName.includes('箱管')" type="danger" plain size="small"
                 @click="allClick('POL无货返空(EXCEL)')">POL无货返空(EXCEL)</el-button>
-            <el-button v-if="roleName.includes('admin') || roleName.includes('箱管')" type="primary" plain size="small"
+            <!-- <el-button v-if="roleName.includes('admin') || roleName.includes('箱管')" type="primary" plain size="small"
                 @click="allClick('进场导入')">进场导入</el-button>
             <el-button v-if="roleName.includes('admin') || roleName.includes('箱管')" type="info" plain size="small"
-                @click="allClick('出场导入')">出场导入</el-button>
+                @click="allClick('出场导入')">出场导入</el-button> -->
             <el-tabs v-model="activeName" type="card" style="margin-top: 8px;">
                 <el-tab-pane label="按港口" name="1">
                     <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page"
@@ -727,7 +727,7 @@ export default {
             }
             if (name == '出场导入') {
                 this.$DialogForm.show({
-                    title: '场导入',
+                    title: '场导入',
                     width: '30%',
                     // data: this.assemblyForm.hmmEdi,
                     menuPosition: 'right',

+ 243 - 0
src/views/boxManagement/enterRecord/components/importModule.vue

@@ -0,0 +1,243 @@
+<template>
+    <div>
+        <el-dialog title="导入数据" append-to-body :visible.sync="excelBox" width="60%" :close-on-click-modal="false"
+            v-dialog-drag>
+            <span>
+                <avue-crud v-if="excelBox" :data="data" :option="option" :table-loading="loading"
+                    :cell-style="cellStyle" @selection-change="selectionChange">
+                    <template v-if="!(type==5||type==6)"  slot="menuLeft" slot-scope="{size}">
+                        <el-button  type="primary" size="mini" icon="el-icon-download" @click="download()">
+                            下载模板
+                        </el-button>
+                        <el-upload  :action="action" :headers="headers" :on-progress="onProgress" :show-file-list=false
+                            accept=".xls,.xlsx" multiple :on-success="onSuccess" :on-error="onError"
+                            :on-change="onChange" style="float: right">
+                            <el-button type="success" size="mini" icon="el-icon-upload">上传数据</el-button>
+                        </el-upload>
+                    </template>
+                </avue-crud>
+            </span>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="excelBox = false" size="mini">取 消</el-button>
+                <el-button type="primary" @click="importData" size="mini">导 入</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { getDicinit } from "@/api/dicSelect/index";
+import { getToken } from "@/util/auth";
+export default {
+    data() {
+        return {
+            loading: false,
+            headers: { "Blade-Auth": 'Bearer ' + getToken() },
+            action: null,
+            excelBox: false,
+            data: [],
+            selectionList: [],
+            option: {
+                height: 500,
+                border: true,
+                align: 'center',
+                menu: false,
+                addBtn: false,
+                refreshBtn: false,
+                columnBtn: false,
+                stripe: true,
+                tip: false,
+                selection: true,
+                column: [
+                    {
+                        label: '放箱号',
+                        prop: 'containerNumber',
+                        overHidden: true,
+                    },
+                    {
+                        label: '箱号',
+                        prop: 'boxCode',
+                        overHidden: true,
+                    },
+                    {
+                        label: '箱型',
+                        prop: 'boxType',
+                        overHidden: true,
+                    },
+                    {
+                        label: '港口',
+                        prop: 'portName',
+                        overHidden: true,
+                    },
+                    {
+                        label: '场站',
+                        prop: 'stationName',
+                        overHidden: true,
+                    },
+                    {
+                        label: '提单号',
+                        prop: 'mblno',
+                        overHidden: true,
+                    },
+                    {
+                        label: '箱动态',
+                        prop: 'boxStatus',
+                        overHidden: true,
+                    },
+                    {
+                        label: '动态日期',
+                        prop: 'boxStatusDate',
+                        overHidden: true,
+                        width: 100,
+                        type: "date",
+                        format: 'yyyy-MM-dd',
+                        valueFormat: 'yyyy-MM-dd'
+                    },
+                    // {
+                    //     label: '单据号',
+                    //     prop: 'billNo',
+                    //     overHidden: true,
+                    // },
+                    {
+                        label: '结果',
+                        prop: 'result',
+                        overHidden: true,
+                    },
+                    {
+                        label: '原因',
+                        prop: 'reason',
+                        overHidden: true,
+                    }
+                ]
+            },
+            url: null,
+            type: null
+        };
+    },
+    created() { },
+    methods: {
+        //去重判断
+        mergeAndDeduplicate(arr1, arr2) {
+            // 合并两个数组
+            const combined = [...arr1, ...arr2];
+            // 使用Map来存储唯一对象(基于id和name)
+            const uniqueMap = new Map();
+            combined.forEach(item => {
+                // 创建一个唯一的键值对
+                const key = `${item.containerNumber}-${item.boxCode}`;
+                if (!uniqueMap.has(key)) {
+                    // 添加到Map中,确保唯一性
+                    uniqueMap.set(key, item);
+                }
+            });
+            // 从Map转换回数组
+            return Array.from(uniqueMap.values());
+        },
+        //文件上传时的钩子
+        onProgress(event, file, fileList) {
+            this.loading = true
+        },
+        //文件上传成功时的钩子
+        onSuccess(res, file) {
+            this.data = this.mergeAndDeduplicate(this.data, res.data)
+            this.$message.success('上传成功');
+            this.loading = false
+        },
+        //文件上传失败时的钩子
+        onError(err, file, fileList) {
+            let errorMsg = err.toString();
+            errorMsg = errorMsg.replace('Error:', '')
+            errorMsg = JSON.parse(errorMsg)
+            this.$message.error(errorMsg.msg);
+            this.loading = false
+        },
+        //上传成功和上传失败时都会被调用
+        onChange(file, fileList) {
+            // if (file.status == "fail") {
+            //     this.$message.error("上传失败");
+            // }
+        },
+        // //上传文件之前的钩子
+        // beforeUpload(file) {
+
+        // },
+        openDialog(type, list) {
+            this.data = []
+            this.selectionList = []
+            this.excelBox = true
+            if (type == 1) {
+                this.action = '/api/blade-los/boxPool/emptyContainerEntryAnalysis'
+                this.url = '/blade-los/boxPool/emptyContainerEntry'
+            }
+            if (type == 2) {
+                this.action = '/api/blade-los/boxPool/emptyContainerAppearanceAnalysis'
+                this.url = '/blade-los/boxPool/emptyContainerAppearance'
+            }
+            if (type == 3) {
+                this.action = '/api/blade-los/boxPool/giveAnEncoreAnalysis'
+                this.url = '/blade-los/boxPool/giveAnEncore'
+            }
+            if (type == 4) {
+                this.action = '/api/blade-los/boxPool/returnEmptyAnalysis'
+                this.url = '/blade-los/boxPool/returnEmpty'
+            }
+            if (type == 5) {
+                this.data=list
+              this.url = '/blade-los/boxPool/emptyContainerEntry'
+            }
+            if (type == 6) {
+                this.data=list
+                this.url = '/blade-los/boxPool/emptyContainerAppearance'
+            }
+            this.type = type
+        },
+        download() {
+            if (this.type == 1) {
+                window.open(`/api/blade-los/boxPool/emptyContainerEntry/template?${this.website.tokenHeader}=${getToken()}`);
+            }
+            if (this.type == 2) {
+                window.open(`/api/blade-los/boxPool/emptyContainerAppearance/template?${this.website.tokenHeader}=${getToken()}`);
+            }
+            if (this.type == 3 || this.type == 4) {
+                window.open(`/api/blade-los/boxPool/giveAnEncore/template?${this.website.tokenHeader}=${getToken()}`);
+            }
+        },
+        selectionChange(list) {
+            this.selectionList = list
+        },
+        importData() {
+            if (this.data.length == 0) {
+                return this.$message.error("请上传数据");
+            }
+            if (this.selectionList.length == 0) {
+                return this.$message.error("请选择数据");
+            }
+            this.loading = true
+            getDicinit('POST', this.url, this.selectionList).then(res => {
+                this.excelBox = false
+                this.$emit('refreshData')
+            }).finally(() => {
+                this.loading = false;
+            })
+        },
+        cellStyle({ row, column, rowIndex, columnIndex }) {
+            if (row.result == '失败') {
+                return {
+                    color: '#F56C6C',
+                }
+            } else {
+                return {
+                    color: '##67C23A',
+                }
+            }
+        }
+    }
+}
+
+</script>
+
+<style lang="scss" scoped>
+::v-deep .el-dialog__body {
+    padding: 10px 8px !important;
+}
+</style>

+ 57 - 4
src/views/boxManagement/enterRecord/index.vue

@@ -16,7 +16,7 @@
           </el-button> -->
         </template>
         <template slot="menu" slot-scope="{ row, index }">
-          <el-button size="small" type="text" @click="rowEdit(row)">{{ row.$cellEdit ? '保存' : '编辑'}}</el-button>
+          <el-button size="small" type="text" @click="rowEdit(row)">{{ row.$cellEdit ? '保存' : '编辑' }}</el-button>
         </template>
         <template slot="fileType" slot-scope="{ row }">
           <span style="color: #1e9fff;cursor: pointer;" @click="inDetail(row)">{{ row.fileType }}</span>
@@ -42,8 +42,9 @@
 </template>
 
 <script>
-import { getList, submit } from "@/api/boxManagement/record/index.js";
+import { getList, submit, emptyContainerEntryFtp } from "@/api/boxManagement/record/index.js";
 import detailsPage from "./detailsPage";
+import importModule from "./components/importModule.vue";
 import { getToken } from "@/util/auth";
 import _ from "lodash";
 export default {
@@ -189,7 +190,8 @@ export default {
     };
   },
   components: {
-    detailsPage
+    detailsPage,
+    importModule
   },
   async created() {
     this.option = await this.getColumnData(this.getColumnName(516), this.optionBack);
@@ -199,12 +201,63 @@ export default {
     }, 100);
   },
   methods: {
+    refreshData() {
+      this.refreshChange()
+    },
     allClick(name) {
       if (name == 'excel导入') {
         this.excelBox = true;
       }
       if (name == 'edi导入') {
-        this.excelBox = true;
+        this.$DialogForm.show({
+          title: '进场导入',
+          width: '30%',
+          // data: this.assemblyForm.hmmEdi,
+          menuPosition: 'right',
+          option: {
+            submitText: '确定',
+            emptyText: '取消',
+            // labelWidth: 130,
+            column: [
+              {
+                label: "场站",
+                span: 24,
+                prop: "corpId",
+                type: 'select',
+                filterable: true,
+                remote: true,
+                dicUrl: "/api/blade-los/bcorps/selectList?status=0&corpTypeName=场站&size=5&current=1&shortName={{key}}",
+                props: {
+                  label: "shortName",
+                  value: "id",
+                  desc: 'code',
+                  res: "data.records"
+                },
+                rules: [{
+                  required: true,
+                  message: "选择场站",
+                  trigger: "blur",
+                }],
+              },
+            ]
+          },
+          beforeClose: (done) => {
+            done()
+          },
+          callback: (res) => {
+            res.done()
+            let obj = {
+              corpId: res.data.corpId,
+              type: 'IN'
+            }
+            emptyContainerEntryFtp(obj).then(res => {
+              this.$message.success("操作成功!");
+              // this.refreshChange()
+              this.$refs.importModule.openDialog(5, res.data.data)
+            })
+            res.close()
+          }
+        })
       }
     },
     uploadBefore(file, done, loading) {

+ 243 - 0
src/views/boxManagement/exitRecord/components/importModule.vue

@@ -0,0 +1,243 @@
+<template>
+    <div>
+        <el-dialog title="导入数据" append-to-body :visible.sync="excelBox" width="60%" :close-on-click-modal="false"
+            v-dialog-drag>
+            <span>
+                <avue-crud v-if="excelBox" :data="data" :option="option" :table-loading="loading"
+                    :cell-style="cellStyle" @selection-change="selectionChange">
+                    <template v-if="!(type==5||type==6)"  slot="menuLeft" slot-scope="{size}">
+                        <el-button  type="primary" size="mini" icon="el-icon-download" @click="download()">
+                            下载模板
+                        </el-button>
+                        <el-upload  :action="action" :headers="headers" :on-progress="onProgress" :show-file-list=false
+                            accept=".xls,.xlsx" multiple :on-success="onSuccess" :on-error="onError"
+                            :on-change="onChange" style="float: right">
+                            <el-button type="success" size="mini" icon="el-icon-upload">上传数据</el-button>
+                        </el-upload>
+                    </template>
+                </avue-crud>
+            </span>
+            <span slot="footer" class="dialog-footer">
+                <el-button @click="excelBox = false" size="mini">取 消</el-button>
+                <el-button type="primary" @click="importData" size="mini">导 入</el-button>
+            </span>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import { getDicinit } from "@/api/dicSelect/index";
+import { getToken } from "@/util/auth";
+export default {
+    data() {
+        return {
+            loading: false,
+            headers: { "Blade-Auth": 'Bearer ' + getToken() },
+            action: null,
+            excelBox: false,
+            data: [],
+            selectionList: [],
+            option: {
+                height: 500,
+                border: true,
+                align: 'center',
+                menu: false,
+                addBtn: false,
+                refreshBtn: false,
+                columnBtn: false,
+                stripe: true,
+                tip: false,
+                selection: true,
+                column: [
+                    {
+                        label: '放箱号',
+                        prop: 'containerNumber',
+                        overHidden: true,
+                    },
+                    {
+                        label: '箱号',
+                        prop: 'boxCode',
+                        overHidden: true,
+                    },
+                    {
+                        label: '箱型',
+                        prop: 'boxType',
+                        overHidden: true,
+                    },
+                    {
+                        label: '港口',
+                        prop: 'portName',
+                        overHidden: true,
+                    },
+                    {
+                        label: '场站',
+                        prop: 'stationName',
+                        overHidden: true,
+                    },
+                    {
+                        label: '提单号',
+                        prop: 'mblno',
+                        overHidden: true,
+                    },
+                    {
+                        label: '箱动态',
+                        prop: 'boxStatus',
+                        overHidden: true,
+                    },
+                    {
+                        label: '动态日期',
+                        prop: 'boxStatusDate',
+                        overHidden: true,
+                        width: 100,
+                        type: "date",
+                        format: 'yyyy-MM-dd',
+                        valueFormat: 'yyyy-MM-dd'
+                    },
+                    // {
+                    //     label: '单据号',
+                    //     prop: 'billNo',
+                    //     overHidden: true,
+                    // },
+                    {
+                        label: '结果',
+                        prop: 'result',
+                        overHidden: true,
+                    },
+                    {
+                        label: '原因',
+                        prop: 'reason',
+                        overHidden: true,
+                    }
+                ]
+            },
+            url: null,
+            type: null
+        };
+    },
+    created() { },
+    methods: {
+        //去重判断
+        mergeAndDeduplicate(arr1, arr2) {
+            // 合并两个数组
+            const combined = [...arr1, ...arr2];
+            // 使用Map来存储唯一对象(基于id和name)
+            const uniqueMap = new Map();
+            combined.forEach(item => {
+                // 创建一个唯一的键值对
+                const key = `${item.containerNumber}-${item.boxCode}`;
+                if (!uniqueMap.has(key)) {
+                    // 添加到Map中,确保唯一性
+                    uniqueMap.set(key, item);
+                }
+            });
+            // 从Map转换回数组
+            return Array.from(uniqueMap.values());
+        },
+        //文件上传时的钩子
+        onProgress(event, file, fileList) {
+            this.loading = true
+        },
+        //文件上传成功时的钩子
+        onSuccess(res, file) {
+            this.data = this.mergeAndDeduplicate(this.data, res.data)
+            this.$message.success('上传成功');
+            this.loading = false
+        },
+        //文件上传失败时的钩子
+        onError(err, file, fileList) {
+            let errorMsg = err.toString();
+            errorMsg = errorMsg.replace('Error:', '')
+            errorMsg = JSON.parse(errorMsg)
+            this.$message.error(errorMsg.msg);
+            this.loading = false
+        },
+        //上传成功和上传失败时都会被调用
+        onChange(file, fileList) {
+            // if (file.status == "fail") {
+            //     this.$message.error("上传失败");
+            // }
+        },
+        // //上传文件之前的钩子
+        // beforeUpload(file) {
+
+        // },
+        openDialog(type, list) {
+            this.data = []
+            this.selectionList = []
+            this.excelBox = true
+            if (type == 1) {
+                this.action = '/api/blade-los/boxPool/emptyContainerEntryAnalysis'
+                this.url = '/blade-los/boxPool/emptyContainerEntry'
+            }
+            if (type == 2) {
+                this.action = '/api/blade-los/boxPool/emptyContainerAppearanceAnalysis'
+                this.url = '/blade-los/boxPool/emptyContainerAppearance'
+            }
+            if (type == 3) {
+                this.action = '/api/blade-los/boxPool/giveAnEncoreAnalysis'
+                this.url = '/blade-los/boxPool/giveAnEncore'
+            }
+            if (type == 4) {
+                this.action = '/api/blade-los/boxPool/returnEmptyAnalysis'
+                this.url = '/blade-los/boxPool/returnEmpty'
+            }
+            if (type == 5) {
+                this.data=list
+              this.url = '/blade-los/boxPool/emptyContainerEntry'
+            }
+            if (type == 6) {
+                this.data=list
+                this.url = '/blade-los/boxPool/emptyContainerAppearance'
+            }
+            this.type = type
+        },
+        download() {
+            if (this.type == 1) {
+                window.open(`/api/blade-los/boxPool/emptyContainerEntry/template?${this.website.tokenHeader}=${getToken()}`);
+            }
+            if (this.type == 2) {
+                window.open(`/api/blade-los/boxPool/emptyContainerAppearance/template?${this.website.tokenHeader}=${getToken()}`);
+            }
+            if (this.type == 3 || this.type == 4) {
+                window.open(`/api/blade-los/boxPool/giveAnEncore/template?${this.website.tokenHeader}=${getToken()}`);
+            }
+        },
+        selectionChange(list) {
+            this.selectionList = list
+        },
+        importData() {
+            if (this.data.length == 0) {
+                return this.$message.error("请上传数据");
+            }
+            if (this.selectionList.length == 0) {
+                return this.$message.error("请选择数据");
+            }
+            this.loading = true
+            getDicinit('POST', this.url, this.selectionList).then(res => {
+                this.excelBox = false
+                this.$emit('refreshData')
+            }).finally(() => {
+                this.loading = false;
+            })
+        },
+        cellStyle({ row, column, rowIndex, columnIndex }) {
+            if (row.result == '失败') {
+                return {
+                    color: '#F56C6C',
+                }
+            } else {
+                return {
+                    color: '##67C23A',
+                }
+            }
+        }
+    }
+}
+
+</script>
+
+<style lang="scss" scoped>
+::v-deep .el-dialog__body {
+    padding: 10px 8px !important;
+}
+</style>

+ 56 - 4
src/views/boxManagement/exitRecord/index.vue

@@ -16,7 +16,7 @@
           </el-button> -->
         </template>
         <template slot="menu" slot-scope="{ row, index }">
-          <el-button size="small" type="text" @click="rowEdit(row)">{{ row.$cellEdit ? '保存' : '编辑'}}</el-button>
+          <el-button size="small" type="text" @click="rowEdit(row)">{{ row.$cellEdit ? '保存' : '编辑' }}</el-button>
         </template>
         <template slot="fileType" slot-scope="{ row }">
           <span style="color: #1e9fff;cursor: pointer;" @click="inDetail(row)">{{ row.fileType }}</span>
@@ -38,12 +38,14 @@
         温馨提示 第一次导入时请先下载模板
       </p>
     </el-dialog>
+    <import-module ref="importModule" @refreshData="refreshData" />
   </div>
 </template>
 
 <script>
-import { getList, submit } from "@/api/boxManagement/record/index.js";
+import { getList, submit, emptyContainerEntryFtp } from "@/api/boxManagement/record/index.js";
 import detailsPage from "./detailsPage";
+import importModule from "./components/importModule.vue";
 import { getToken } from "@/util/auth";
 import _ from "lodash";
 export default {
@@ -189,7 +191,8 @@ export default {
     };
   },
   components: {
-    detailsPage
+    detailsPage,
+    importModule
   },
   async created() {
     this.option = await this.getColumnData(this.getColumnName(514), this.optionBack);
@@ -199,12 +202,61 @@ export default {
     }, 100);
   },
   methods: {
+    refreshData() {
+      this.refreshChange()
+    },
     allClick(name) {
       if (name == 'excel导入') {
         this.excelBox = true;
       }
       if (name == 'edi导入') {
-        this.excelBox = true;
+        this.$DialogForm.show({
+          title: '出场导入',
+          width: '30%',
+          menuPosition: 'right',
+          option: {
+            submitText: '确定',
+            emptyText: '取消',
+            column: [
+              {
+                label: "场站",
+                span: 24,
+                prop: "corpId",
+                type: 'select',
+                filterable: true,
+                remote: true,
+                dicUrl: "/api/blade-los/bcorps/selectList?status=0&corpTypeName=场站&size=5&current=1&shortName={{key}}",
+                props: {
+                  label: "shortName",
+                  value: "id",
+                  desc: 'code',
+                  res: "data.records"
+                },
+                rules: [{
+                  required: true,
+                  message: "选择场站",
+                  trigger: "blur",
+                }],
+              },
+            ]
+          },
+          beforeClose: (done) => {
+            done()
+          },
+          callback: (res) => {
+            res.done()
+            console.log(res)
+            let obj = {
+              corpId: res.data.corpId,
+              type: 'OUT'
+            }
+            emptyContainerEntryFtp(obj).then(res => {
+              this.$message.success("操作成功!");
+              this.$refs.importModule.openDialog(6, res.data.data)
+            })
+            res.close()
+          }
+        })
       }
     },
     uploadBefore(file, done, loading) {