Browse Source

Merge remote-tracking branch 'origin/yonghu' into yonghu

LZH 2 years ago
parent
commit
30b944297c

+ 34 - 19
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/LocationViewController.java

@@ -1,27 +1,31 @@
 package com.ruoyi.web.controller.warewms.ams;
 
-import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
+import com.ruoyi.ams.config.service.ILotattConfigService;
+import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
 import com.ruoyi.ams.inv.service.IInvLotLocIdService;
 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.constant.Constant;
-import com.ruoyi.base.domain.BaseLocationInfo;
+import com.ruoyi.base.domain.BaseLocationZone;
 import com.ruoyi.base.domain.dto.BasLocationGuiExtDTO;
-import com.ruoyi.base.service.IBaseLocationInfoService;
-import com.ruoyi.common.annotation.Log;
+import com.ruoyi.base.service.IBaseLocationZoneService;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.enums.BusinessType;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
 
 import java.util.List;
 
 /**
+ * 库位视图
+ *
  * Created by IntelliJ IDEA.
- * User: andy.qu
- * Date: 2022/3/16
+ * User: kaka
+ * Date: 2022/3/22
  */
 @RestController
 @RequestMapping("/ams/locationView")
@@ -30,11 +34,11 @@ public class LocationViewController extends BaseController {
     @Autowired
     private LocationViewService locationViewService;
     @Autowired
-    private IBaseLocationInfoService baseLocationInfoService;
+    private IInvLotLocIdService invLotLocIdService;
     @Autowired
-    private InvLotLocIdMapper invLotLocIdMapper;
+    private ILotattConfigService lotattConfigService;
     @Autowired
-    private IInvLotLocIdService invLotLocIdService;
+    private IBaseLocationZoneService baseLocationZoneService;
 
     @GetMapping(value = "/view")
     public AjaxResult getInfo(LocationViewForm locationViewForm) {
@@ -59,17 +63,28 @@ public class LocationViewController extends BaseController {
         return invLotLocIdService.clear(id.toString(),Constant.WAREHOUSE_ID, logger.getName());
     }
 
-    /**
-     * 库存是否有货状态调整
-     *
-     * @param locationId
-     * @return
-     */
-    @Log(title = "PDA库存状态调整", businessType = BusinessType.UPDATE)
-
     @GetMapping(value = "/setIsEmpty/{id}")
     public AjaxResult adjLocationIsEmpty(@PathVariable("id") Long id) {
 
         return invLotLocIdService.adjLocationIsEmpty(id.toString(), Constant.WAREHOUSE_ID, logger.getName());
     }
+
+    @GetMapping(value = "/locationLotatt/{locationId}")
+    public AjaxResult locationLotatt(@PathVariable("locationId") Long locationId) {
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdService.selectInvLocIdLotattByLocationId(locationId);
+        return AjaxResult.success(invLotLocIdLotattVOS);
+    }
+
+    @GetMapping("/lotattConfigList")
+    public AjaxResult lotattConfigList() {
+        return AjaxResult.success(lotattConfigService.queryLotattConfigList());
+    }
+
+    @GetMapping("/queryZoneDict")
+    public AjaxResult queryZoneDict()
+    {
+        BaseLocationZone query = new BaseLocationZone();
+        query.setStatus("0");
+        return AjaxResult.success(baseLocationZoneService.selectBaseLocationZoneList(query));
+    }
 }

+ 96 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/LocationViewSafeController.java

@@ -0,0 +1,96 @@
+package com.ruoyi.web.controller.warewms.ams;
+
+import com.ruoyi.ams.config.service.ILotattConfigService;
+import com.ruoyi.ams.inv.domain.vo.InvLotLocIdLotattVO;
+import com.ruoyi.ams.inv.service.IInvLotLocIdService;
+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.constant.Constant;
+import com.ruoyi.base.domain.BaseLocationZone;
+import com.ruoyi.base.domain.BaseWarehouse;
+import com.ruoyi.base.domain.dto.BasLocationGuiExtDTO;
+import com.ruoyi.base.service.IBaseLocationZoneService;
+import com.ruoyi.common.annotation.Log;
+import com.ruoyi.common.core.controller.BaseController;
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.enums.BusinessType;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 库位视图
+ * 需要登陆
+ *
+ * Created by IntelliJ IDEA.
+ * User: kaka
+ * Date: 2022/3/22
+ */
+@RestController
+@RequestMapping("/ams/safe/locationView/")
+public class LocationViewSafeController extends BaseController {
+
+    @Autowired
+    private LocationViewService locationViewService;
+    @Autowired
+    private IInvLotLocIdService invLotLocIdService;
+    @Autowired
+    private ILotattConfigService lotattConfigService;
+    @Autowired
+    private IBaseLocationZoneService baseLocationZoneService;
+
+    @GetMapping(value = "/view")
+    public AjaxResult getInfo(LocationViewForm locationViewForm) {
+        LocationViewVO locationViewVO = locationViewService.locationView(locationViewForm);
+        return AjaxResult.success(locationViewVO);
+    }
+
+    @GetMapping(value = "/invView")
+    public AjaxResult getInvView(LocationViewForm locationViewForm) {
+        List<BasLocationGuiExtDTO> basLocationGuiDTOS = locationViewService.queryLocationGuiExt(locationViewForm);
+        return AjaxResult.success(basLocationGuiDTOS);
+    }
+
+    @Log(title = "库位任务状态调整", businessType = BusinessType.UPDATE)
+    @GetMapping(value = "/lockLoc/{id}")
+    public AjaxResult lockLoc(@PathVariable("id") Long id) {
+        return invLotLocIdService.adjLocationStockStatus(id.toString(), Constant.WAREHOUSE_ID
+                , logger.getName());
+    }
+
+    @Log(title = "库位库存清除", businessType = BusinessType.CLEAN)
+    @GetMapping(value = "/clearLoc/{id}")
+    public AjaxResult clearLoc(@PathVariable("id") Long id) {
+        return invLotLocIdService.clear(id.toString(),Constant.WAREHOUSE_ID, logger.getName());
+    }
+
+    @Log(title = "库存有货状态调整", businessType = BusinessType.CLEAN)
+    @GetMapping(value = "/setIsEmpty/{id}")
+    public AjaxResult adjLocationIsEmpty(@PathVariable("id") Long id) {
+        return invLotLocIdService.adjLocationIsEmpty(id.toString(), Constant.WAREHOUSE_ID, logger.getName());
+    }
+
+    @GetMapping(value = "/locationLotatt/{locationId}")
+    public AjaxResult locationLotatt(@PathVariable("locationId") Long locationId) {
+        List<InvLotLocIdLotattVO> invLotLocIdLotattVOS = invLotLocIdService.selectInvLocIdLotattByLocationId(locationId);
+        return AjaxResult.success(invLotLocIdLotattVOS);
+    }
+
+    @GetMapping("/lotattConfigList")
+    public AjaxResult lotattConfigList() {
+        return AjaxResult.success(lotattConfigService.queryLotattConfigList());
+    }
+
+    @GetMapping("/queryZoneDict")
+    public AjaxResult queryZoneDict()
+    {
+        BaseLocationZone query = new BaseLocationZone();
+        query.setStatus("0");
+        return AjaxResult.success(baseLocationZoneService.selectBaseLocationZoneList(query));
+    }
+}

+ 12 - 1
ruoyi-common/src/main/java/com/ruoyi/common/core/redis/RedisCache.java

@@ -26,6 +26,11 @@ public class RedisCache {
     @Autowired
     public RedisTemplate redisTemplate;
 
+    /**
+     * 默认过期时长,单位:秒
+     */
+    public final static long DEFAULT_EXPIRE = 60 * 60 * 24;
+
     /**
      * 缓存基本的对象,Integer、String、实体类等
      *
@@ -40,6 +45,8 @@ public class RedisCache {
         boolean isOK = redisTemplate.opsForValue().setIfAbsent(key, value);
         if (isOK) {
             redisTemplate.opsForList().rightPush(RedisKey.LOCK_LIST + token, key);
+            expire(key, DEFAULT_EXPIRE);
+            expire(RedisKey.LOCK_LIST + token, DEFAULT_EXPIRE);
         }
         return isOK;
     }
@@ -55,11 +62,15 @@ public class RedisCache {
         }
     }
 
-    public void unlockCacheObject(Long token,final String key) {
+    public void unlockCacheObject(Long token, final String key) {
         redisTemplate.opsForList().remove(RedisKey.LOCK_LIST + token, 1, RedisKey.LOCK_LOCATION + key);
         redisTemplate.delete(RedisKey.LOCK_LOCATION + key);
     }
 
+    public void unlockCacheLocation(final String key) {
+        redisTemplate.delete(RedisKey.LOCK_LOCATION + key);
+    }
+
     public boolean checkIsLock(String key) {
         boolean isLock = false;
         Object obj = redisTemplate.opsForValue().get(key);

+ 34 - 3
ruoyi-ui/src/api/ams/locationView.js

@@ -18,21 +18,52 @@ export function locationInvView(query) {
 
 export function lockLocRequest(id) {
   return request({
-    url: '/ams/locationView/lockLoc/'+id,
+    url: '/ams/safe/locationView/lockLoc/'+id,
+    // url: '/ams/locationView/lockLoc/'+id,
     method: 'get'
   })
 }
 
 export function clearLocRequest(id) {
   return request({
-    url: '/ams/locationView/clearLoc/'+id,
+    url: '/ams/safe/locationView/clearLoc/'+id,
+    // url: '/ams/locationView/clearLoc/'+id,
     method: 'get'
   })
 }
 
 export function occupyLocRequest(id) {
   return request({
-    url: '/ams/locationView/setIsEmpty/'+id,
+    url: '/ams/safe/locationView/setIsEmpty/'+id,
+    // url: '/ams/locationView/setIsEmpty/'+id,
     method: 'get'
   })
 }
+
+export function lotattInfo(id) {
+  return request({
+    url: '/ams/locationView/locationLotatt/'+id,
+    method: 'get'
+  })
+}
+
+export function lotattConfigList() {
+  return request({
+    url: '/ams/locationView/lotattConfigList',
+    method: 'get'
+  })
+}
+
+export function queryLocationZoneDict() {
+  return request({
+    url: '/ams/locationView/queryZoneDict',
+    method: 'get',
+  })
+}
+
+export function queryWarehouseDict() {
+  return request({
+    url: '',
+    method: 'get',
+  })
+}

+ 14 - 11
ruoyi-ui/src/views/ams/inv/locationView/index.vue

@@ -107,11 +107,8 @@
     </el-container>
 </template>
 <script>
-import {clearLocRequest, locationInvView, lockLocRequest, occupyLocRequest} from "@/api/ams/locationView";
-import {lotattInfo} from "@/api/ams/invLotLocId";
-import {lotattConfigList} from "@/api/ams/config";
-import {queryWarehouseDict} from "@/api/base/warehouse";
-import {queryLocationZoneDict} from "@/api/base/locationZone";
+import { clearLocRequest,locationInvView,queryLocationZoneDict,lockLocRequest,lotattConfigList
+  ,lotattInfo,occupyLocRequest,queryWarehouseDict} from "@/api/ams/locationView";
 
   export default {
     data () {
@@ -158,6 +155,8 @@ import {queryLocationZoneDict} from "@/api/base/locationZone";
     activated () {
     },
     created () {
+      // this.getWarehouseList()
+      this.getBasZoneList()
       this.getDataList()
       this.getItemopention()
       this.timer = setInterval(this.getDataList, 5000)
@@ -179,12 +178,6 @@ import {queryLocationZoneDict} from "@/api/base/locationZone";
       },
       getDataList () {
         this.dataListLoading = true
-        queryWarehouseDict().then(response => {
-          this.warehouseCombo = response.data
-        });
-        queryLocationZoneDict().then(response => {
-          this.locationZoneCombo = response.data
-        })
         locationInvView(this.queryParams).then(response => {
           this.locationZoneList = response.data
         })
@@ -252,6 +245,16 @@ import {queryLocationZoneDict} from "@/api/base/locationZone";
           });
         });
       },
+      getBasZoneList() {
+        queryLocationZoneDict().then(response => {
+          this.locationZoneCombo = response.data
+        })
+      },
+      getWarehouseList() {
+        queryWarehouseDict().then(response => {
+          this.warehouseCombo = response.data
+        });
+      },
     }
   }
 </script>

+ 7 - 1
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -22,6 +22,7 @@ import com.ruoyi.base.domain.BaseLocationZone;
 import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.base.utils.IdSequenceUtils;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
@@ -60,6 +61,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
     private IInvLotLocIdService invLotLocIdService;
     @Autowired
     private IBusinessService iBusinessService;
+    @Autowired
+    private RedisCache redisCache;
 
     /**
      * 查询库位库存信息
@@ -353,6 +356,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
             wmsBoxInfo.setUpdateBy(updateBy);
             iWmsBoxInfoService.updateWmsBoxInfoIsNull(wmsBoxInfo);
         }
+        // 释放redis锁
+        redisCache.unlockCacheLocation(id.toString());
         return AjaxResult.success("操作成功!");
     }
 
@@ -386,7 +391,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
 
         log.error("【修改库位任务占用状态】:" + baseLocationInfo.getLocationNo() + ","
                 + (isIdle ? Constant.STOCK_STATUS.STOCK10.getValue() : Constant.STOCK_STATUS.STOCK00.getValue()));
-
+        // 释放redis锁
+        redisCache.unlockCacheLocation(baseLocationInfo.getId().toString());
         return AjaxResult.success("操作成功!");
     }
 

+ 1 - 1
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/ActAllocationDetailsServiceImpl.java

@@ -271,7 +271,7 @@ public class ActAllocationDetailsServiceImpl implements IActAllocationDetailsSer
             actAllocationQuery.setOrderNo(orderNo);
             actAllocationQuery.setLocationId(locationId);
             actAllocationQuery.setLotatt07(palletNo);
-            actAllocationQuery.setStatus(Constant.ORDER_STS.STS21.getValue());
+            actAllocationQuery.setStatus(Constant.ORDER_STS.STS20.getValue());
             List<ActAllocationDetailsFrom> actAllocationDetailsFromList = this.selectActAllocationDetailsInvLotAttList(actAllocationQuery);
             for (ActAllocationDetailsFrom allocationDetails : actAllocationDetailsFromList) {
                 ActAllocationDetails allocationDetailsUpdate = new ActAllocationDetails();

+ 15 - 10
warewms-ams/src/main/java/com/ruoyi/ams/order/service/impl/WmsDocOrderHeaderServiceImpl.java

@@ -552,15 +552,15 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
     @Override
     public List<PickingListVO> pickingList(String palletNo) {
         List<PickingListVO> pickingListVOS = new ArrayList<>();
-        List<ActAllocationDetails> allocationDetails = actAllocationDetailsService.queryAllocationDetailsToPickByPalletNo(palletNo);
-        for (ActAllocationDetails de : allocationDetails) {
-            PickingListVO pickingListVO = new PickingListVO();
-            pickingListVO.setOrderNo(de.getOrderNo());
-            pickingListVO.setSku(de.getMaterial());
-            pickingListVO.setPickQty(de.getPickQty().doubleValue());
-            pickingListVO.setToBePickQty(de.getQty().subtract(de.getPickQty()).doubleValue());
-            pickingListVOS.add(pickingListVO);
-        }
+//        List<ActAllocationDetails> allocationDetails = actAllocationDetailsService.queryAllocationDetailsToPickByPalletNo(palletNo);
+//        for (ActAllocationDetails de : allocationDetails) {
+//            PickingListVO pickingListVO = new PickingListVO();
+//            pickingListVO.setOrderNo(de.getOrderNo());
+//            pickingListVO.setSku(de.getMaterial());
+//            pickingListVO.setPickQty(de.getPickQty().doubleValue());
+//            pickingListVO.setToBePickQty(de.getQty().subtract(de.getPickQty()).doubleValue());
+//            pickingListVOS.add(pickingListVO);
+//        }
         // 二次组盘查询不到
         if (pickingListVOS.size() == 0) {
             InvLocIdSearchFrom invLocIdSearchFrom = new InvLocIdSearchFrom();
@@ -572,7 +572,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
                 PickingListVO pickingListVO = new PickingListVO();
                 pickingListVO.setOrderNo("");
                 pickingListVO.setSku(locIdLotattVO.getSku());
-                pickingListVO.setPickQty(locIdLotattVO.getQty());
+                pickingListVO.setPickQty(BigDecimal.ZERO.doubleValue());
                 pickingListVO.setToBePickQty(locIdLotattVO.getQty());
                 pickingListVOS.add(pickingListVO);
             }
@@ -1204,6 +1204,10 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             query.setStatus(Constant.ORDER_STS.STS30.getValue());
             actAllocationDetailsFrom = actAllocationDetailsService.selectActAllocationDetailsInvLotAttByModel(query);
         }
+        if (actAllocationDetailsFrom == null) {
+            query.setStatus(Constant.ORDER_STS.STS40.getValue());
+            actAllocationDetailsFrom = actAllocationDetailsService.selectActAllocationDetailsInvLotAttByModel(query);
+        }
         if (actAllocationDetailsFrom != null) {
             codeSkuRelationshipSoVO.setOrderNo(actAllocationDetailsFrom.getOrderNo());
             codeSkuRelationshipSoVO.setSku(actAllocationDetailsFrom.getMaterial());
@@ -1214,6 +1218,7 @@ public class WmsDocOrderHeaderServiceImpl implements IWmsDocOrderHeaderService {
             BigDecimal qty = actAllocationDetailsFrom.getQty().subtract(actAllocationDetailsFrom.getPickQty());
             codeSkuRelationshipSoVO.setQty(qty.doubleValue());
         }
+        // todo 如果想要返回当前组盘托盘的数量,可能需要传入托盘号
         return codeSkuRelationshipSoVO;
     }
 

+ 3 - 4
warewms-ams/src/main/resources/mapper/docOrder/WmsDocOrderHeaderMapper.xml

@@ -142,7 +142,7 @@
 
     <resultMap type="com.ruoyi.ams.order.vo.CheckOutVO" id="CheckOutVOResult">
         <result property="orderNo"    column="order_no"    />
-        <result property="palletNo"    column="box_no"    />
+        <result property="palletNo"    column="palletNo"    />
         <result property="locationNo"    column="location_no"    />
     </resultMap>
 
@@ -376,19 +376,18 @@
 
     <select id="selectCheckOutList" parameterType="java.util.List" resultMap="CheckOutVOResult">
         select
-               de.order_no,w.box_no,b.location_no
+               de.order_no,b.location_no,att.lotatt07 palletNo
         from wms_doc_order_details de
         left join base_sku sk on de.sku = sk.sku
         left join act_allocation_details act on de.order_no = act.order_no and de.order_line_no = act.line_no
         right join inv_lot_loc_id lotinv on lotinv.sku = de.sku and lotinv.lotnum = act.lotnum and lotinv.location_id = act.location_id
         left join inv_lot_att att on act.lotnum = att.lotnum
-        left join wms_box_info w on act.location_id = w.location_id
         left join base_location_info b on b.id = act.location_id
         where de.order_no in
         <foreach item="orderNo" collection="list" open="(" separator="," close=")">
             #{orderNo}
         </foreach>
         and act.`status` = '20' and b.stock_status = '00' and b.is_empty = 'N'
-        group by de.order_no,w.box_no,b.location_no
+        group by de.order_no,b.location_no,att.lotatt07
     </select>
 </mapper>

+ 2 - 1
warewms-base/src/main/java/com/ruoyi/base/service/impl/BaseLocationInfoServiceImpl.java

@@ -10,6 +10,7 @@ import com.ruoyi.base.mapper.BaseLocationZoneMapper;
 import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.base.utils.CommonUtils;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.redis.RedisCache;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.StringUtils;
@@ -40,7 +41,7 @@ public class BaseLocationInfoServiceImpl implements IBaseLocationInfoService {
     @Autowired
     private BaseLocationZoneMapper baseLocationZoneMapper;
     @Autowired
-    private RedisTemplate<String, String> redisTemplate;
+    private RedisCache redisCache;
 
     /**
      * 查询库位信息