Pārlūkot izejas kodu

库位视图操作修改

andy 3 gadi atpakaļ
vecāks
revīzija
440d79bf48

+ 41 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/LocationViewController.java

@@ -1,8 +1,11 @@
 package com.ruoyi.web.controller.warewms.ams;
 
+import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
 import com.ruoyi.ams.locationView.domain.form.LocationViewForm;
 import com.ruoyi.ams.locationView.domain.vo.LocationViewVO;
 import com.ruoyi.ams.locationView.service.LocationViewService;
+import com.ruoyi.base.domain.BaseLocationInfo;
+import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,11 +22,47 @@ public class LocationViewController extends BaseController {
 
     @Autowired
     private LocationViewService locationViewService;
+    @Autowired
+    private IBaseLocationInfoService baseLocationInfoService;
+    @Autowired
+    private InvLotLocIdMapper invLotLocIdMapper;
 
     @GetMapping(value = "/view")
-    public AjaxResult getInfo(LocationViewForm locationViewForm)
-    {
+    public AjaxResult getInfo(LocationViewForm locationViewForm) {
         LocationViewVO locationViewVO = locationViewService.locationView(locationViewForm);
         return AjaxResult.success(locationViewVO);
     }
+
+    @GetMapping(value = "/lockLoc/{id}")
+    public AjaxResult lockLoc(@PathVariable("id") Long id) {
+        BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoById(id);
+        if (baseLocationInfo != null) {
+            if (baseLocationInfo.getStockStatus().equals("00")) {
+                baseLocationInfoService.updateLocationStockStatus(id, "10");
+                return AjaxResult.success("锁定成功");
+            } else {
+                baseLocationInfoService.updateLocationStockStatus(id, "00");
+                return AjaxResult.success("解锁成功");
+            }
+        } else {
+            return AjaxResult.error("查询不到对应的库位");
+        }
+    }
+
+    @GetMapping(value = "/clearLoc/{id}")
+    public AjaxResult clearLoc(@PathVariable("id") Long id) {
+        BaseLocationInfo baseLocationInfo = baseLocationInfoService.selectBaseLocationInfoById(id);
+        if (baseLocationInfo != null) {
+            if (baseLocationInfo.getStockStatus().equals("00")) {
+                baseLocationInfo.setIsEmpty("Y");
+                baseLocationInfoService.updateBaseLocationInfo(baseLocationInfo);
+                invLotLocIdMapper.deleteInvLotLocIdByLocationId(baseLocationInfo.getId());
+                return AjaxResult.success("清空成功");
+            } else {
+                return AjaxResult.error("锁定中的库位无法清空");
+            }
+        } else {
+            return AjaxResult.error("查询不到对应的库位");
+        }
+    }
 }

+ 2 - 9
ruoyi-ui/src/api/ams/locationView.js

@@ -8,21 +8,14 @@ export function locationView(query) {
   })
 }
 
-export function lockLoc(id) {
+export function lockLocRequest(id) {
   return request({
     url: '/ams/locationView/lockLoc/'+id,
     method: 'get'
   })
 }
 
-export function occupyLoc(id) {
-  return request({
-    url: '/ams/locationView/occupyLoc/'+id,
-    method: 'get'
-  })
-}
-
-export function clearLoc(id) {
+export function clearLocRequest(id) {
   return request({
     url: '/ams/locationView/clearLoc/'+id,
     method: 'get'

+ 21 - 9
ruoyi-ui/src/views/ams/inv/locationView/index.vue

@@ -35,7 +35,7 @@
         <li
           v-for="(item, index) in divList"
           :key="index"
-          @click="selected">
+          @click="selected(item)">
           <div v-if="!item.locationNo" style="background-color: #fff;"><!--空格没有的库位--></div>
           <div class="div" v-else-if="item.stockStatus === '10'" style="background-color: yellow">
             <div style="text-align: center;font-weight: bold;">{{item.locationNo}}</div>
@@ -48,11 +48,11 @@
         </li>
       </ul>
     </div>
-    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+    <el-dialog title="操作" :visible.sync="open" width="500px" append-to-body>
       <el-form>
         <el-form-item>
           <el-button type="primary" @click="lockLoc()">锁定/解锁</el-button>
-          <el-button type="primary" @click="occupyLoc()">占用</el-button>
+          <!--<el-button type="primary" @click="occupyLoc()">占用</el-button>-->
           <el-button type="primary" @click="clearLoc()">清空</el-button>
           <!--<el-button type="primary" @click="submitForm">初始化一个空托盘</el-button>-->
         </el-form-item>
@@ -62,7 +62,7 @@
 </template>
 
 <script>
-  import { locationView, lockLoc, occupyLoc, clearLoc} from "@/api/ams/locationView";
+  import { locationView, lockLocRequest, occupyLocRequest, clearLocRequest } from "@/api/ams/locationView";
   import { queryLocationZoneDict } from "@/api/base/locationZone";
   import { queryWarehouseDict } from "@/api/base/warehouse";
 
@@ -115,8 +115,11 @@
         })
       },
       selected(item) {
-        this.currentSelect = item.id
-        this.open = true;
+        console.log(item)
+        if (item.locationNo) {
+          this.currentSelect = parseInt(item.id)
+          this.open = true;
+        }
       },
       handleQuery() {
         this.search()
@@ -126,13 +129,22 @@
         this.handleQuery();
       },
       lockLoc() {
-
+        lockLocRequest(this.currentSelect).then(response => {
+          this.$modal.msgSuccess(response.msg);
+          this.search();
+        });
       },
       occupyLoc() {
-
+        occupyLocRequest(this.currentSelect).then(response => {
+          this.$modal.msgSuccess(response.msg);
+          this.init()
+        });
       },
       clearLoc() {
-
+        clearLocRequest(this.currentSelect).then(response => {
+          this.$modal.msgSuccess(response.msg);
+          this.init()
+        });
       }
     }
   };

+ 8 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/mapper/InvLotLocIdMapper.java

@@ -91,4 +91,12 @@ public interface InvLotLocIdMapper
      * @return
      */
      List<InvLotLocIdLotattVO> selectInvLocIdLotattList(InvLocIdSearchFrom invLocIdSearchFrom);
+
+    /**
+     * 删除库位库存信息
+     *
+     * @param locationId 库位id
+     * @return 结果
+     */
+    int deleteInvLotLocIdByLocationId(Long locationId);
 }

+ 1 - 0
warewms-ams/src/main/java/com/ruoyi/ams/locationView/service/LocationViewService.java

@@ -53,6 +53,7 @@ public class LocationViewService {
             infoVO.setSku(b.getSku());
             infoVO.setStockStatus(b.getStockStatus());
             infoVO.setIsEmpty(b.getIsEmpty());
+            infoVO.setId(b.getId());
             colList.add(infoVO);
         }
 

+ 4 - 0
warewms-ams/src/main/resources/mapper/ams/InvLotLocIdMapper.xml

@@ -264,4 +264,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by lpad(b.row_no, 11, '0'),b.row_index,lpad(b.shift_no, 11, '0'),b.shift_index,lpad(b.col_no, 11, '0'),b.col_index desc
     </select>
 
+    <delete id="deleteInvLotLocIdByLocationId" parameterType="Long">
+        delete from inv_lot_loc_id where location_id = #{locationId}
+    </delete>
+
 </mapper>