From 5ce4edffbb7da529cf09b7a3c5d66183c9141df1 Mon Sep 17 00:00:00 2001
From: TanYibin <5491541@qq.com>
Date: Fri, 17 May 2024 10:58:07 +0800
Subject: [PATCH] 库位监控BUG修复

---
 ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue                                                      | 708 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/locationMonitor/controller/LocationMonitorController.java |  49 ++++++++++++++++++++++++++-----------------------
 2 files changed, 289 insertions(+), 468 deletions(-)

diff --git a/ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue b/ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue
index 227b413..e830bb4 100644
--- a/ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue
+++ b/ant-design-vue-jeecg/src/views/system/monitor/locationStatus.vue
@@ -1,119 +1,104 @@
 <template>
   <a-card :bordered="false">
-  <div class="container-div">
-    <div class="row">
-      <div class="col-sm-12 select-info">
-        <form id="container-form">
-          <div class="select-list">
-            <ul id="select_info">
-              <li>
-                <a-select
-                  show-search
-                  placeholder="请选择库区"
-                  option-filter-prop="children"
-                  v-model="zoneCode"
-                  @change="refresh"
-                  style="width: 200px">
-                  <a-select-option selected="0" id="zoneCode" v-for="item in zoneList" :key="item.name" :value="item.code">{{ item.name }}
-                  </a-select-option>
-                </a-select>
-              </li>
-              <li>第
-                <select id="editable-num" name="num" style="width: 70px" />
-              </li>
-              <li>
-                <select id="editable-select" name="col" @click="show" style="width: 70px">
-                  <option value="row" selected>行</option>
-                  <option value="line">列</option>
-                  <option value="layer">层</option>
-                </select>
-              </li>
-              <li>
-                <a-button type="primary" @click="Search()" icon="search">查询</a-button>
-              </li>
-              <li>
-                <a-button  @click='expressDelivery()' v-if="this.expressDeliveryVisible" type='primary'>快速出库</a-button>
-              </li>
-              <li>
-                <a-button  @click="expressStorage()" type="primary" v-if="expressStorageVisible">快速入库</a-button>
-              </li>
-            </ul>
-          </div>
-        </form>
-      </div>
-      <div class="col-sm-12 select-info">
-        <form id="receiptHeader-form">
-          <div class="select-list">
-            <ul id="img_list" style="">
-              <li>空柜空闲:<img src="~@/assets/icon/grid_rest.png"></li>
-              <li>空盘空闲:<img src="~@/assets/icon/grid_empty.png"></li>
-<!--              <li>半盘空闲:<img src="~@/assets/icon/grid_half.png"></li>-->
-              <li>整盘空闲:<img src="~@/assets/icon/grid_all.png"></li>
-              <li>空柜锁定:<img src="~@/assets/icon/grid_emp_lock.png"></li>
-              <li>空盘锁定:<img src="~@/assets/icon/grid_empty_lock.png"></li>
-<!--              <li>半盘锁定:<img src="~@/assets/icon/grid_half_lock.png"></li>-->
-              <li>整盘锁定:<img src="~@/assets/icon/grid_all_lock.png"></li>
-<!--              <li>空柜禁用:<img src="~@/assets/icon/grid_emp_waing.png"></li>-->
-<!--              <li>空盘禁用:<img src="~@/assets/icon/grid_empty_waring.png"></li>-->
-<!--              <li>半盘禁用:<img src="~@/assets/icon/grid_half_waring.png"></li>-->
-<!--              <li>整盘禁用:<img src="~@/assets/icon/ContainerDisabled.png"></li>-->
-              <li>
-                <span style="font-size: 12px">库位统计情况:</span>
-                <input style="width: 400px;  font-size: 12px" type="text" id="zone" disabled/>
-              </li>
-            </ul>
-            <br><br>
-            <ul id="info_list">
-              <li><span>库位:</span><input type="text" id="code" disabled/></li>
-              <li><span>容器编码:</span><input type="text" id="containerCode" disabled/></li>
-              <li><span>物料信息:<select id="material" style="width: auto; min-width: 200px;padding: 0px 8px;appearance: none;pointer-events: none;"><option>无</option></select></span></li>
-            </ul>
-          </div>
-        </form>
-      </div>
-
-      <div class="col-sm-12 select-info">
-        <div id="borderCol" style="overflow-y: auto;white-space:nowrap" v-show="showPrise">
-          <div class="location" id="location">
+    <div class="container-div">
+      <div class="row">
+        <div class="col-sm-12 select-info">
+          <form id="container-form">
+            <div class="select-list">
+              <ul id="select_info">
+                <li>
+                  <a-select
+                    show-search
+                    placeholder="请选择库区"
+                    option-filter-prop="children"
+                    v-model="zoneCode"
+                    @change="refresh"
+                    style="width: 200px">
+                    <a-select-option selected="0" id="zoneCode" v-for="item in zoneList" :key="item.name" :value="item.code">{{ item.name }}
+                    </a-select-option>
+                  </a-select>
+                </li>
+                <li>第
+                  <a-select
+                    show-search
+                    option-filter-prop="children"
+                    v-model="num"
+                    style="width: 70px">
+                    <a-select-option id="num" v-for="num in nums" :key="num" :value="num">{{ num }}
+                    </a-select-option>
+                  </a-select>
+                </li>
+                <li>
+                  <a-select
+                    show-search
+                    option-filter-prop="children"
+                    v-model="col"
+                    @change="refresh"
+                    style="width: 70px">
+                    <a-select-option id="col" v-for="item in colList" :key="item.name" :value="item.code">{{ item.name }}
+                    </a-select-option>
+                  </a-select>
+                </li>
+                <li>
+                  <a-button type="primary" @click="search()" icon="search">查询</a-button>
+                </li>
+                <li>
+                  <a-button @click='expressDelivery()' v-if="expressDeliveryVisible" type='primary'>快速出库</a-button>
+                </li>
+                <li>
+                  <a-button @click="expressStorage()" type="primary" v-if="expressStorageVisible">快速入库</a-button>
+                </li>
+              </ul>
+            </div>
+          </form>
+        </div>
+        <div class="col-sm-12 select-info">
+          <form id="receiptHeader-form">
+            <div class="select-list">
+              <ul id="img_list">
+                <li style="font-size: 12px">空柜空闲:<img src="~@/assets/icon/grid_rest.png"></li>
+                <li style="font-size: 12px">空盘空闲:<img src="~@/assets/icon/grid_empty.png" alt=""></li>
+                <li style="font-size: 12px">整盘空闲:<img src="~@/assets/icon/grid_all.png"></li>
+                <li style="font-size: 12px">空柜锁定:<img src="~@/assets/icon/grid_emp_lock.png"></li>
+                <li style="font-size: 12px">空盘锁定:<img src="~@/assets/icon/grid_empty_lock.png"></li>
+                <li style="font-size: 12px">整盘锁定:<img src="~@/assets/icon/grid_all_lock.png"></li>
+              </ul>
+              <ul id="info_list">
+                <li>
+                  <span style="font-size: 12px">库位统计情况:</span>
+                  <input style="width: 600px; font-size: 12px; border: none;" type="text" id="zone" disabled/>
+                </li><br><br>
+                <li><span>库位:</span><input type="text" style="width: 100px; font-size: 12px; border: none;" id="code" disabled/></li>
+                <li><span>容器编码:</span><input type="text" style="width: 200px; font-size: 12px; border: none;" id="containerCode" disabled/></li><br><br>
+                <li>
+                  <span>物料信息:
+                    <select id="material" style="width: 600px; padding: 0px 8px;border: none;">
+                      <option>无</option>
+                    </select>
+                  </span>
+                </li>
+              </ul>
+            </div>
+          </form>
+        </div>
+        <div class="col-sm-12 select-info">
+          <div id="borderCol" style="overflow-y: auto;white-space:nowrap" v-show="showPrise">
+            <div class="location" id="location"/>
           </div>
+          <a-spin tip="库位视图生成中..." :spinning="spinning">
+            <a-skeleton active :loading="loading" :paragraph="{ rows: 5 }"/>
+          </a-spin>
         </div>
-        <a-spin tip="库位视图生成中..." :spinning="spinning">
-          <a-skeleton active :loading="loading" :paragraph="{ rows: 5 }"/>
-        </a-spin>
       </div>
-
-
     </div>
-  </div>
-
-    <ExpressStorageModal ref="ExpressStorageModal" @ok="Search"></ExpressStorageModal>
-    <ExpressDeliveryModal ref="ExpressDeliveryModal" @ok="Search"></ExpressDeliveryModal>
+    <ExpressStorageModal ref="ExpressStorageModal" @ok="search"></ExpressStorageModal>
+    <ExpressDeliveryModal ref="ExpressDeliveryModal" @ok="search"></ExpressDeliveryModal>
   </a-card>
 </template>
 
 <script>
-var prefix = "/location/locationMonitor";
-var grid_row;
-var grid_line;
-var grid_layer;
-var list_info;
-var grid_num_1 = 0;
-var grid_num_2 = 0;
-var grid_num_3 = 0;
-var grid_num_4 = 0;
-var grid_num_5 = 0;
-var grid_num_6 = 0;
-var grid_num_7 = 0;
-var grid_num_8 = 0;
-var grid_num_9 = 0;
-var grid_num_10 = 0;
-var grid_num_11 = 0;
-var grid_num_12 = 0;
-var currentContainerCode;
-var currentLocationCode = 0;
-var currentMaterialCode = 0;
 
-import huahengUI from '../../../assets/css/huahengUI.css'
+import huahengUI from '@/assets/css/huahengUI.css'
 import $ from '../../../assets/js/jquery-1.11.1.min'
 import grid_rest from '@/assets/icon/grid_rest.png'
 import grid_empty from '@/assets/icon/grid_empty.png'
@@ -128,21 +113,15 @@ import grid_empty_lock from '@/assets/icon/grid_empty_lock.png'
 import grid_half_lock from '@/assets/icon/grid_half_lock.png'
 import grid_all_lock from '@/assets/icon/grid_all_lock.png'
 import rel_empty from '@/assets/icon/rel_empty.png'
-import Vue from 'vue'
-import {ACCESS_TOKEN} from "@/store/mutation-types"
 import {getInventoryDetailByLocationCode, getZoneList} from '@/api/api'
-import MaterialTaskModal from "../task/modules/MaterialTaskModal";
 import ExpressDeliveryModal from "@views/system/monitor/modules/ExpressDeliveryModal";
 import ExpressStorageModal from "@views/system/monitor/modules/ExpressStorageModal";
 import {JeecgListMixin} from '@/mixins/JeecgListMixin'
+import {getAction, postAction} from "@api/manage";
 
 
 export default {
   name: "locationStatus",
-  zoneCode: "",
-  // parameter:{
-  //   code:'',
-  // } ,
   mixins: [JeecgListMixin],
   components: {
     ExpressStorageModal,
@@ -154,24 +133,36 @@ export default {
       loading: true,
       showPrise: false,
       expressDeliveryVisible: false,
-      expressStorageVisible:false,
-      // loading:true,
+      expressStorageVisible: false,
+      col: "row",
+      colList: [
+        {code: "row", name: "行"},
+        {code: "line", name: "列"},
+        {code: "layer", name: "层"}
+      ],
       zoneCode: '',
       zoneList: [],
+      num: 1,
+      nums: [],
       model: {},
-      locationContent: ''
+      url: {
+        getStatus: "/location/locationMonitor/getStatus",
+        getLocationInfo: "/location/locationMonitor/getLocationInfo",
+        getAllLocation: "/location/locationMonitor/getAllLocation"
+      },
+      grid_row: null,
+      grid_line: null,
+      grid_layer: null,
+      list_info: null,
+      currentLocationCode: 0,
     }
   },
-
-
   created() {
-    let _this = this
-    _this.loadFrom()
-    window.gridMsg = _this.gridMsg
-    window.Mclose = _this.Mclose
-    window.lays = _this.lays
+    this.loadFrom()
+    window.gridMsg = this.gridMsg
+    window.mClose = this.mClose
+    window.lays = this.lays
   },
-
   mounted() {
     // 监听浏览器宽度的改变
     const resizeObserver = new ResizeObserver(entries => {
@@ -180,89 +171,54 @@ export default {
       }
     });
     resizeObserver.observe(document.querySelector('.location'));
+
+    let that = this;
+    setTimeout(function () {
+      that.refresh();
+    }, 1000);
   },
   methods: {
+    loadData() {
+      // 空方法,为了覆盖混入文件中的方法,解决报错
+    },
     loadFrom() {
       getZoneList().then((res) => {
         if (res.success) {
           this.zoneList = res.result;
           if (this.zoneList.length > 0) {
             this.zoneCode = this.zoneList[0].code;
-            let _this = this;
-            this.resetAjax(this.zoneCode);
           }
         }
       })
     },
-    refresh: function () {
-      $.ajax({
-        url: window._CONFIG['domianURL'] + prefix + "/getAllLocation",
-        type: "post",
-        data: {
-          zoneCode: this.zoneCode
-        },
-        headers: {
-          "X-Access-Token": Vue.ls.get(ACCESS_TOKEN)
-        },
-        success: function (res) {
-          grid_row = res.result.maxRow;
-          grid_line = res.result.maxLine;
-          grid_layer = res.result.maxLayer;
-        }
-      });
-      let num = $("#editable-select").val();
-      $("#editable-num").children().remove();
-      if (num === "row") {
-        for (let i = 1; i <= grid_row; i++) {
-          $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
-        }
-      } else if (num === "line") {
-        for (let i = 1; i <= grid_line; i++) {
-          $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
-        }
-      } else if (num === "layer") {
-        for (let i = 1; i <= grid_layer; i++) {
-          $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
-        }
+    handleNumsSelect() {
+      let col = this.col;
+      if (col === "row") {
+        this.nums = this.grid_row;
+      } else if (col === "line") {
+        this.nums = this.grid_line;
+      } else if (col === "layer") {
+        this.nums = this.grid_layer;
+      } else {
+        this.$message.warning("错误");
       }
-
-      let zoneCode = $("#zoneCode").val();
-      this.resetAjax(this.zoneCode);
-      // this.show();
     },
-    show: function () {
-      //库位类型和行列层选择
-      $("#editable-select").change(function () {
-        let num = $("#editable-select").val();
-        $("#editable-num").children().remove();
-        if (num === "row") {
-          for (let i = 1; i <= grid_row; i++) {
-            $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
-          }
-        } else if (num === "line") {
-          for (let i = 1; i <= grid_line; i++) {
-            $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
-          }
-        } else if (num === "layer") {
-          for (let i = 1; i <= grid_layer; i++) {
-            $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
-          }
+    refresh() {
+      let url = this.url.getAllLocation
+      getAction(url, {zoneCode: this.zoneCode}).then(res => {
+        if (res.success) {
+          this.grid_row = res.result.maxRow;
+          this.grid_line = res.result.maxLine;
+          this.grid_layer = res.result.maxLayer;
+        } else {
+          this.$message.warning(res.message)
         }
-      });
-
-      $("#zoneCode").change(function () {
-        let zoneCode = $("#zoneCode").val();
-        this.resetAjax(this.zoneCode);
-      });
-    },
-
-    //边框高度
-    border() {
-      let box_height = $("#borderCol").offset().top;
-      let window_height = $(window).height() - 20;
-      $("#borderCol").css({"height": window_height - box_height});
+      }).finally(() => {
+        this.handleNumsSelect();
+        this.search();
+      })
+      this.locationStatistics();
     },
-
     //格子宽度
     changeMargin() {
       let box_width = 0;
@@ -270,12 +226,12 @@ export default {
         box_width = document.getElementById("location").offsetWidth;
       }
       box_width = box_width - 80;
-      let num = $("#editable-select").val();
+      let num = this.col;
       let grid_width;
       if (num === "layer" || num === "row") {
-        grid_width = box_width / grid_line;
+        grid_width = box_width / this.grid_line;
       } else if (num === "line") {
-        grid_width = box_width / grid_row;
+        grid_width = box_width / this.grid_row;
       }
       if (grid_width >= 50) {
         $(".grid").css({"width": "50px", "height": "50px"});
@@ -285,40 +241,32 @@ export default {
         $(".grid").css({"width": grid_width, "height": grid_width});
       }
     },
-
     //tips信息
     lays(x) {
       let $j = $(x);
       let row = $j.attr("data-i");
       let line = $j.attr("data-j");
       let layers = $j.attr("data-k");
-
       row = parseInt(row);
       line = parseInt(line);
       layers = parseInt(layers);
-      if (list_info) {
-        for (let i = 0; i < list_info.length; i++) {
-          if (list_info[i].row === row && list_info[i].icolumn === line && list_info[i].layer === layers) {
+      if (this.list_info) {
+        for (const element of this.list_info) {
+          if (element.row === row && element.icolumn === line && element.layer === layers) {
             let str_info = '';
             let container_code = '';
-            let list_qty = 0;
-            if (list_info[i].containerCode) {
-              container_code = "\n容器编码:" + list_info[i].containerCode + "";
-              if (list_info[i].materialName) {
-                for (let j = 0; j < list_info[i].materialName.length; j++) {
-                  let list_batch = list_info[i].batch[j] === null ? "无" : list_info[i].batch[j] === "" ? "无" : list_info[i].batch[j];
-                  list_qty += list_info[i].qty[j];
-                  if (j == list_info[i].materialName.length - 1) {
-                    str_info = str_info + "\n物料信息:批次->" + list_batch + ",物料名称->" + list_info[i].materialName[j] + ",物料编码->" + list_info[i].materialCode[j] +
-                      ",数量->" + list_qty + ""
-                  }
+            if (element.containerCode) {
+              container_code = "\n容器编码:" + element.containerCode + "";
+              if (element.materialName) {
+                for (let j = 0; j < element.materialName.length; j++) {
+                  let list_batch = element.batch[j].length == 0 ? "无" : element.batch[j];
+                  let list_qty = element.qty[j];
+                  str_info += "\n物料信息:批次->" + list_batch + ",物料名称->" + element.materialName[j] + ",物料编码->" + element.materialCode[j] + ",数量->" + list_qty + ""
                 }
               }
             }
-            let code = list_info[i].code === null ? "无" : list_info[i].code;
+            let code = element.code === null ? "无" : element.code;
             $("[data-i='" + row + "']" + "[data-j='" + line + "']" + "[data-k='" + layers + "']").attr({"title": "第" + row + "行,第" + line + "列,第" + layers + "层\n库位:" + code + container_code + str_info});
-            // Vue.prototype.$Jnotification.success({message: '系统提示', description: "第"+row+"行,第"+line+"列,第"+ layers +"层<br>库位:"+ code + container_code + str_info, duration: 4})
-
           }
         }
       } else {
@@ -326,15 +274,15 @@ export default {
       }
     },
     // 快速入库
-    expressStorage(){
+    expressStorage() {
       let json = {
-        "containerCode":currentContainerCode,
-        "locationCode":currentLocationCode
+        "containerCode": this.currentContainerCode,
+        "locationCode": this.currentLocationCode
       }
       this.$refs.ExpressStorageModal.edit(json);
     },
     // 获取库存信息
-    getInventory(locationCode){
+    getInventory(locationCode) {
       let params = {
         locationCode: locationCode
       }
@@ -342,8 +290,8 @@ export default {
         if (res.success) {
           let parameter = [];
           let newArr = res.result.records;
-          for(var i of newArr){
-            var param = {
+          for (let i of newArr) {
+            let param = {
               materialCode: i.materialCode,
               shipQty: i.qty,
               inventoryDetailId: i.id,
@@ -358,230 +306,174 @@ export default {
       });
     },
     //快速出库
-    expressDelivery(){
-      this.getInventory(currentLocationCode);
+    expressDelivery() {
+      this.getInventory(this.currentLocationCode);
     },
     // 显示快速出库
-    revealExpressDelivery(code, materialCode){
-      if (materialCode){
-        this.expressDeliveryVisible = true;
-      }else {
-        this.expressDeliveryVisible = false;
-      }
+    revealExpressDelivery(code, materialCode) {
+      this.expressDeliveryVisible = !!materialCode;
     },
     // 显示快速入库
-    revealExpressStorage(code){
-      if(code){
-        this.expressStorageVisible = true
-      }else {
-        this.expressStorageVisible = false;
-      }
+    revealExpressStorage(code) {
+      this.expressStorageVisible = !!code;
     },
-
     //关闭tips
-    Mclose(x) {
+    mClose(x) {
       //关闭
       // Vue.prototype.$Jnotification.error({message: '系统提示', description: "鼠标拿走了", duration: 4})
     },
-
     //库位信息请求和状态显示
     ajaxGrid(x, info) {
       let _this = this
-      // let load=layer.msg('加载中', {icon: 16,shade: 0.4,time: false});
-      $.ajax({
-        url: window._CONFIG['domianURL'] + prefix + "/getLocationInfo",
-        type: "post",
-        headers: {
-          "X-Access-Token": Vue.ls.get(ACCESS_TOKEN)
-        },
-        data: info,
-        success: function (res) {
-          if (res.code === 200 || res.result) {
-            grid_num_1 = 0;
-            grid_num_2 = 0;
-            grid_num_3 = 0;
-            grid_num_4 = 0;
-            grid_num_5 = 0;
-            grid_num_6 = 0;
-            grid_num_7 = 0;
-            grid_num_8 = 0;
-            grid_num_9 = 0;
-            grid_num_10 = 0;
-            grid_num_11 = 0;
-            grid_num_12 = 0;
-            if (x === "row") {
-              for (let i = 0; i < res.result.length; i++) {
-                let index = res.result[i].icolumn + ((res.result[i].layer - 1) * grid_line);
-                index = index - 1;
-                _this.resShow(res, index, i);
-              }
-              _this.clearLocation(grid_line, grid_layer);
-              // layer.close(load);
-            } else if (x === "line") {
-              for (let i = 0; i < res.result.length; i++) {
-                let index = res.result[i].row + ((res.result[i].layer - 1) * grid_row);
-                index = index - 1;
-                _this.resShow(res, index, i);
-              }
-              _this.clearLocation(grid_row, grid_layer);
-              // layer.close(load);
-            } else if (x === "layer") {
-              for (let i = 0; i < res.result.length; i++) {
-                let index = res.result[i].icolumn + ((res.result[i].row - 1) * grid_line);
-                index = index - 1;
-                _this.resShow(res, index, i);
-              }
-              _this.clearLocation(grid_line, grid_row);
-              // layer.close(load);
+      let url = this.url.getLocationInfo;
+      postAction(url, info).then(res => {
+        if (res.success) {
+          if (x === "row") {
+            for (let i = 0; i < res.result.length; i++) {
+              let index = res.result[i].icolumn + ((res.result[i].layer - 1) * this.grid_line);
+              index = index - 1;
+              _this.resShow(res, index, i);
+            }
+            _this.clearLocation(this.grid_line, this.grid_layer);
+          } else if (x === "line") {
+            for (let i = 0; i < res.result.length; i++) {
+              let index = res.result[i].row + ((res.result[i].layer - 1) * this.grid_row);
+              index = index - 1;
+              _this.resShow(res, index, i);
             }
-          } else if (res.code !== 200) {
-            // layer.close(load);
-            // layer.open({
-            //   title: '错误',
-            //   content: res.msg
-            // });
+            _this.clearLocation(this.grid_row, this.grid_layer);
+          } else if (x === "layer") {
+            for (let i = 0; i < res.result.length; i++) {
+              let index = res.result[i].icolumn + ((res.result[i].row - 1) * this.grid_line);
+              index = index - 1;
+              _this.resShow(res, index, i);
+            }
+            _this.clearLocation(this.grid_line, this.grid_row);
           }
-          list_info = res.result;
-        },
-        error: function (req, msg) {
-          console.log(msg);
+        } else {
+          this.$message.error(res.message);
         }
+        this.list_info = res.result;
+      }).finally(() => {
+
       })
     },
     //库位请求的结果显示
     resShow(res, index, i) {
-      // if (res.result[i].deleted === false) {
-      var row = res.result[i].row;
-      var jColumn = res.result[i].icolumn;
-      var kLayer = res.result[i].layer;
+      let row = res.result[i].row;
+      let jColumn = res.result[i].icolumn;
+      let kLayer = res.result[i].layer;
       if (res.result[i].locationAttribute === "1") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_rest,
           "isTrue": 1
         });
-        grid_num_1 = grid_num_1 + 1;
       } else if (res.result[i].locationAttribute === "2") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_empty,
           "isTrue": 1
         });
-        grid_num_2 = grid_num_2 + 1;
       } else if (res.result[i].locationAttribute === "3") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_half,
           "isTrue": 1
         });
-        grid_num_3 = grid_num_3 + 1;
       } else if (res.result[i].locationAttribute === "4") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_all,
           "isTrue": 1
         });
-        grid_num_4 = grid_num_4 + 1;
       } else if (res.result[i].locationAttribute === "5") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_emp_lock,
           "isTrue": 1
         });
-        grid_num_5 = grid_num_5 + 1;
       } else if (res.result[i].locationAttribute === "6") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_empty_lock,
           "isTrue": 1
         });
-        grid_num_6 = grid_num_6 + 1;
       } else if (res.result[i].locationAttribute === "7") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_half_lock,
           "isTrue": 1
         });
-        grid_num_7 = grid_num_7 + 1;
       } else if (res.result[i].locationAttribute === "8") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_all_lock,
           "isTrue": 1
         });
-        grid_num_8 = grid_num_8 + 1;
       } else if (res.result[i].locationAttribute === "9") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_emp_waing,
           "isTrue": 1
         });
-        grid_num_9 = grid_num_9 + 1;
       } else if (res.result[i].locationAttribute === "10") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_empty_waring,
           "isTrue": 1
         });
-        grid_num_10 = grid_num_10 + 1;
       } else if (res.result[i].locationAttribute === "11") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_half_waring,
           "isTrue": 1
         });
-        grid_num_11 = grid_num_11 + 1;
       } else if (res.result[i].locationAttribute === "12") {
         $("[data-i='" + row + "']" + "[data-j='" + jColumn + "']" + "[data-k='" + kLayer + "']").attr({
           "src": grid_all_waring,
           "isTrue": 1
         });
-        grid_num_12 = grid_num_12 + 1;
       }
-
     },
-
     //清除将数据库中没有的库位
     clearLocation(x, y) {
       for (let j = 0; j < x * y; j++) {
-        let sta = $(".grid").eq(j).attr("isTrue");
+        let $grid = $(".grid");
+        let sta = $grid.eq(j).attr("isTrue");
         if (sta !== "1") {
-          $(".grid").eq(j).attr({"src": rel_empty, "onmouseover": "", "onclick": ""});
+          $grid.eq(j).attr({"src": rel_empty, "onmouseover": "", "onclick": ""});
         }
       }
       this.spinning = false;
       this.showPrise = true;
       this.loading = false;
     },
-
     //点击显示当前库位信息
     gridMsg(msg) {
       let $j = $(msg);
       let row = $j.attr("data-i");
       let line = $j.attr("data-j");
       let layers = $j.attr("data-k");
-
       row = parseInt(row);
       line = parseInt(line);
       layers = parseInt(layers);
-      if (list_info) {//缓存查询
-        for (let i = 0; i < list_info.length; i++) {
-          if (list_info[i].row === row && list_info[i].icolumn === line && list_info[i].layer === layers) {
+      //缓存查询
+      if (this.list_info) {
+        for (const element of this.list_info) {
+          if (element.row === row && element.icolumn === line && element.layer === layers) {
             let materialCode = '';
-            if (list_info[i].materialName) {
-              let list_batch = '';
-              let list_qty = 0;
-              $("#material").children().remove();
-              for (let j = 0; j < list_info[i].materialName.length; j++) {
-                list_batch = list_info[i].batch[j] === null ? "无" : list_info[i].batch[j] === "" ? "无" : list_info[i].batch[j];
-                list_qty += list_info[i].qty[j];
-                let str_info = "批次->" + list_batch + ",物料名称->" + list_info[i].materialName[j] + ",物料编码->" + list_info[i].materialCode[j] +
-                  ",数量->" + list_qty + "";
-                if (j == list_info[i].materialName.length - 1) {
-                  $("#material").append("<option>" + str_info + "</option>");
-                }
-                currentMaterialCode = list_info[i].materialCode[j]
-                materialCode = list_info[i].materialCode[j];
+            let $material = $("#material");
+            if (element.materialName) {
+              $material.children().remove();
+              let str_info = '';
+              for (let j = 0; j < element.materialName.length; j++) {
+                let list_batch = element.batch[j].length === 0 ? "无" : element.batch[j];
+                let list_qty = element.qty[j];
+                str_info = "批次->" + list_batch + ",物料名称->" + element.materialName[j] + ",物料编码->" + element.materialCode[j] + ",数量->" + list_qty + "\r\n";
+                materialCode = element.materialCode[j];
+                $material.append("<option>" + str_info + "</option>");
               }
             } else {
-              $("#material").children().remove();
-              $("#material").append("<option>无</option>");
+              $material.children().remove();
+              $material.append("<option>无</option>");
             }
-            $("#code").val(list_info[i].code);
-            $("#containerCode").val(list_info[i].containerCode === "" ? "无" : list_info[i].containerCode);
-            currentContainerCode = list_info[i].containerCode;
-            currentLocationCode = $("#code").val()
-            this.revealExpressDelivery(list_info[i].code,materialCode);
-            this.revealExpressStorage(list_info[i].code);
+            let $code = $("#code");
+            $code.val(element.code);
+            $("#containerCode").val(element.containerCode === "" ? "无" : element.containerCode);
+            this.currentContainerCode = element.containerCode;
+            this.currentLocationCode = $code.val()
+            this.revealExpressDelivery(element.code, materialCode);
+            this.revealExpressStorage(element.code);
             break;
           }
         }
@@ -589,129 +481,55 @@ export default {
         return ""
       }
     },
-
-    //页面初始化请求
-    resetAjax(zoneCode) {
-      var _this = this;
-      $.ajax({
-        url: window._CONFIG['domianURL'] + prefix + "/getAllLocation",
-        type: "post",
-        data: {
-          zoneCode: zoneCode
-        },
-        headers: {
-          "X-Access-Token": Vue.ls.get(ACCESS_TOKEN)
-        },
-        success: function (res) {
-          grid_row = res.result.maxRow;
-          grid_line = res.result.maxLine;
-          grid_layer = res.result.maxLayer;
-          //初始格子
-          $("#location").children().remove();
-          for (let i = 1; i <= grid_layer; i++) {
-            // var index=i+1;<span style='margin-top:30px'>第"+ index +"行</span>
-            $(".location").append("<br>");
-            for (let j = 1; j <= grid_line; j++) {
-              // $(".location").append("<img data-i='1' data-j="+j+" data-k="+ i +" class='grid'>");
-              $(".location").append("<img v-html data-i='1' data-j=" + j + " data-k=" + i + " class='grid' onmouseove='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
-            }
-          }
-          let num = $("#editable-select").val();
-          $("#editable-num").children().remove();
-          if (num === "row") {
-            for (let i = 1; i <= grid_row; i++) {
-              $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
-            }
-          } else if (num === "line") {
-            for (let i = 1; i <= grid_line; i++) {
-              $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
-            }
-          } else if (num === "layer") {
-            for (let i = 1; i <= grid_layer; i++) {
-              $("#editable-num").append("<option value='" + i + "'>" + i + "</option>")
-            }
-          }
-          _this.Search();
-        }
-      });
-    },
     //搜索平面库位
-    Search() {
+    search() {
       this.spinning = true;
       this.showPrise = false;
       this.loading = true;
-      let index = $("#editable-select").val();
-      let num = $("#editable-num").val();
-      let zoneCode = "";
-
-      $("#code").val("");
-      $("#containerCode").val("");
-      $("#material").children().remove();
-      $("#material").append("<option>无</option>");
+      let col = this.col;
+      let num = this.num;
       let data;
-      this.seachZone();
-      if (index === "row") {
+
+      $("#location").children().remove();
+      let $location = $(".location");
+      if (col === "row") {
         data = {zoneCode: this.zoneCode, row: num};
-        $("#location").children().remove();
-        for (let i = grid_layer; i > 0; i--) {
-          $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + i + "层</span>");
-          for (let j = 1; j <= grid_line; j++) {
-            $(".location").append("<img data-i=" + num + " data-j=" + j + " data-k=" + i + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
+        for (let i = this.grid_layer; i > 0; i--) {
+          $location.append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + i + "层</span>");
+          for (let j = 1; j <= this.grid_line; j++) {
+            $location.append("<img data-i=" + num + " data-j=" + j + " data-k=" + i + " class='grid' onmouseover='lays(this)' onmouseout='mClose(this)' onclick='gridMsg(this)'>");
           }
         }
-        // this.changeMargin();
-        this.ajaxGrid(index, data);
-      } else if (index === "line") {
+      } else if (col === "line") {
         data = {zoneCode: this.zoneCode, line: num};
-        $("#location").children().remove();
-        for (let k = grid_layer; k > 0; k--) {
-          $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + k + "层</span>");
-          for (let l = 1; l <= grid_row; l++) {
-            $(".location").append("<img data-i=" + l + " data-j=" + num + " data-k=" + k + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
+        for (let k = this.grid_layer; k > 0; k--) {
+          $location.append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + k + "层</span>");
+          for (let l = 1; l <= this.grid_row; l++) {
+            $location.append("<img data-i=" + l + " data-j=" + num + " data-k=" + k + " class='grid' onmouseover='lays(this)' onmouseout='mClose(this)' onclick='gridMsg(this)'>");
           }
         }
-        // this.changeMargin();
-        this.ajaxGrid(index, data);
-      } else if (index === "layer") {
+      } else if (col === "layer") {
         data = {zoneCode: this.zoneCode, layer: num};
-        $("#location").children().remove();
-        for (let m = 1; m <= grid_row; m++) {
-          $(".location").append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + m + "行</span>");
-          for (let n = 1; n <= grid_line; n++) {
-            $(".location").append("<img data-i=" + m + " data-j=" + n + " data-k=" + num + " class='grid' onmouseover='lays(this)' onmouseout='Mclose(this)' onclick='gridMsg(this)'>");
+        for (let m = 1; m <= this.grid_row; m++) {
+          $location.append("<br><span style='display: inline-block;text-align: right;width: 50px; margin-right: 10px;'>第" + m + "行</span>");
+          for (let n = 1; n <= this.grid_line; n++) {
+            $location.append("<img data-i=" + m + " data-j=" + n + " data-k=" + num + " class='grid' onmouseover='lays(this)' onmouseout='mClose(this)' onclick='gridMsg(this)'>");
           }
         }
-        // this.changeMargin();
-        this.ajaxGrid(index, data);
       }
+      this.ajaxGrid(col, data);
     },
-    seachZone() {
-      let _this = this
-
-      $.ajax({
-        url: window._CONFIG['domianURL'] + prefix + "/getStatus",
-        data: {
-          zoneCode: _this.zoneCode
-        },
-        headers: {
-          "X-Access-Token": Vue.ls.get(ACCESS_TOKEN)
-        },
-        success: function (response) {
-          if (response.code == 200) {
-            $("#zone").val("库位总数:" + response.result.location + ", 空库位:" + response.result.emptyLocation +
-              ", 空托盘库位:" + response.result.haveContainLocation + ", 有货库位:" + response.result.haveInventoryLocation)
-          } else {
-            alert(response.message)
-          }
-        },
-        error: function () {
-          alert("未知的错误")
+    locationStatistics() {
+      let url = this.url.getStatus;
+      getAction(url, {zoneCode: this.zoneCode}).then(res => {
+        if (res.success) {
+          $("#zone").val("库位总数:" + res.result.location + ",空库位:" + res.result.emptyLocation +
+            ",空托盘库位:" + res.result.haveContainLocation + ",有货库位:" + res.result.haveInventoryLocation)
+        } else {
+          this.$message.warning(res.message)
         }
-      })
-    },
+      }).finally()
+    }
   }
 }
-</script>
-
-<style scoped>
-</style>
\ No newline at end of file
+</script>
\ No newline at end of file
diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/locationMonitor/controller/LocationMonitorController.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/locationMonitor/controller/LocationMonitorController.java
index fa121d6..8c9d38a 100644
--- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/locationMonitor/controller/LocationMonitorController.java
+++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/config/locationMonitor/controller/LocationMonitorController.java
@@ -9,6 +9,7 @@ import java.util.stream.Collectors;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 
+import cn.hutool.core.util.ObjectUtil;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.wms.config.container.entity.Container;
 import org.jeecg.modules.wms.config.container.service.IContainerService;
@@ -40,7 +41,8 @@ import lombok.extern.slf4j.Slf4j;
 @RequestMapping("/location/locationMonitor")
 @Slf4j
 public class LocationMonitorController {
-    @Autowired
+
+    @Resource
     private IContainerService containerService;
     @Resource
     private ILocationService locationService;
@@ -51,7 +53,6 @@ public class LocationMonitorController {
      * 库存概括
      */
     @GetMapping("/getStatus")
-    @ResponseBody
     public Result<?> getStatus(String zoneCode, HttpServletRequest req) {
         LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery();
         HuahengJwtUtil.setWarehouseCode(queryWrapper, Location.class, req);
@@ -95,16 +96,20 @@ public class LocationMonitorController {
      * 查询库位列表
      */
     @PostMapping("/getLocationInfo")
-    @ResponseBody
-    public Result<?> getLocationInfo(String zoneCode, String row, String line, String layer, String grid, HttpServletRequest req) {
+    public Result<?> getLocationInfo(@RequestBody Location inLocation, HttpServletRequest req) {
+        String zoneCode = inLocation.getZoneCode();
         if (StringUtils.isEmpty(zoneCode)) {
             return Result.error("zoneCode 不能为空");
         }
+        Integer row = inLocation.getRow();
+        Integer line = inLocation.getIcolumn();
+        Integer layer = inLocation.getLayer();
+        Integer grid = inLocation.getGrid();
         /* 查询库位信息 */
         LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
         HuahengJwtUtil.setWarehouseCode(locationLambdaQueryWrapper, Location.class, req);
-        locationLambdaQueryWrapper.eq(StringUtils.isNotEmpty(row), Location::getRow, row).eq(StringUtils.isNotEmpty(line), Location::getIcolumn, line)
-            .eq(StringUtils.isNotEmpty(layer), Location::getLayer, layer).eq(StringUtils.isNotEmpty(grid), Location::getGrid, grid)
+        locationLambdaQueryWrapper.eq(ObjectUtil.isNotNull(row), Location::getRow, row).eq(ObjectUtil.isNotNull(line), Location::getIcolumn, line)
+            .eq(ObjectUtil.isNotNull(layer), Location::getLayer, layer).eq(ObjectUtil.isNotNull(grid), Location::getGrid, grid)
             .eq(StringUtils.isNotEmpty(zoneCode), Location::getZoneCode, zoneCode);
         List<Location> locations = locationService.list(locationLambdaQueryWrapper);
         List<Location> locationList = new ArrayList<>();
@@ -115,13 +120,13 @@ public class LocationMonitorController {
         HuahengJwtUtil.setWarehouseCode(inventoryDetailLambda, InventoryDetail.class, req);
         List<InventoryDetail> inventoryDetailList = inventoryDetailService.list(inventoryDetailLambda);
 
-        for (Location location1 : locations) {
+        for (Location location : locations) {
             List<InventoryDetail> inventoryDetails =
-                inventoryDetailList.stream().filter(inventoryDetail1 -> inventoryDetail1.getLocationCode().equals(location1.getCode())).collect(Collectors.toList());
+                inventoryDetailList.stream().filter(inventoryDetail1 -> inventoryDetail1.getLocationCode().equals(location.getCode())).collect(Collectors.toList());
 
             int locationAttribute = 0;
-            String status = location1.getStatus();
-            String containerCode = location1.getContainerCode();
+            String status = location.getStatus();
+            String containerCode = location.getContainerCode();
             List<String> materialNameList = inventoryDetails.stream().map(InventoryDetail::getMaterialName).collect(Collectors.toList());
             List<String> batchList = inventoryDetails.stream().map(InventoryDetail::getBatch).collect(Collectors.toList());
             List<String> materialCodeList = inventoryDetails.stream().map(InventoryDetail::getMaterialCode).collect(Collectors.toList());
@@ -133,10 +138,10 @@ public class LocationMonitorController {
                     if (inventoryDetails.size() == 0) {
                         locationAttribute = LocationStatus.IDLE_EMPTY_CONTAINER;
                     } else {
-                        location1.setMaterialName(materialNameList);
-                        location1.setMaterialCode(materialCodeList);
-                        location1.setBatch(batchList);
-                        location1.setQty(qtyList);
+                        location.setMaterialName(materialNameList);
+                        location.setMaterialCode(materialCodeList);
+                        location.setBatch(batchList);
+                        location.setQty(qtyList);
                         locationAttribute = LocationStatus.IDLE_SOME_CONTAINER;
                     }
                 }
@@ -147,17 +152,17 @@ public class LocationMonitorController {
                     if (inventoryDetails.size() == 0) {
                         locationAttribute = LocationStatus.LOCK_EMPTY_CONTAINER;
                     } else {
-                        location1.setMaterialName(materialNameList);
-                        location1.setMaterialCode(materialCodeList);
-                        location1.setBatch(batchList);
-                        location1.setQty(qtyList);
+                        location.setMaterialName(materialNameList);
+                        location.setMaterialCode(materialCodeList);
+                        location.setBatch(batchList);
+                        location.setQty(qtyList);
                         locationAttribute = LocationStatus.LOCK_SOME_CONTAINER;
                     }
                 }
             }
 
-            location1.setLocationAttribute(String.valueOf(locationAttribute));
-            locationList.add(location1);
+            location.setLocationAttribute(String.valueOf(locationAttribute));
+            locationList.add(location);
         }
         return Result.ok(locations);
     }
@@ -165,8 +170,7 @@ public class LocationMonitorController {
     /**
      * 查询库位列表
      */
-    @PostMapping("/getAllLocation")
-    @ResponseBody
+    @GetMapping("/getAllLocation")
     public Result<?> getAllLocation(@RequestParam(name = "zoneCode") String zoneCode, HttpServletRequest req) {
         if (StringUtils.isEmpty(zoneCode)) {
             return Result.error("zoneCode 不能为空");
@@ -176,5 +180,4 @@ public class LocationMonitorController {
         HuahengJwtUtil.setWarehouseCode(req, location);
         return Result.ok(locationService.getAllLocation(location));
     }
-
 }
--
libgit2 0.22.2