Selaa lähdekoodia

1.选矿出入库逻辑优化
2.AGV的搬运任务BUG解决
3.拆包机异常关闭BUG解决

ChenYang 1 vuosi sitten
vanhempi
commit
1db3cdf422

+ 10 - 2
ruoyi-admin/src/main/java/com/ruoyi/web/controller/warewms/ams/InvLotLocIdController.java

@@ -19,6 +19,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.util.Assert;
@@ -35,6 +36,7 @@ import java.util.stream.Collectors;
  * @author andy
  * @date 2022-03-14
  */
+@Slf4j
 @RestController
 @RequestMapping("/ams/invLotLocId")
 public class InvLotLocIdController extends BaseController {
@@ -119,7 +121,10 @@ public class InvLotLocIdController extends BaseController {
     @PostMapping("/moveEmptyPalletOut")
     private AjaxResult handleEmptyPalletOut(@RequestParam String locationId) {
         BaseLocationInfo baseLocationInfo = iBucketLocInvService.allocateLocationInfo();
-        if (ObjectUtil.isNull(baseLocationInfo)) return AjaxResult.error("baseLocationInfo is null");
+        if (ObjectUtil.isNull(baseLocationInfo)) {
+            log.warn("InvLotLocIdController-handleEmptyPalletOut baseLocationInfo is null");
+            return AjaxResult.error("empty pallet location is empty");
+        }
         return move(buildInvLotLocIdMoveForm(String.valueOf(baseLocationInfo.getId()), locationId));
     }
 
@@ -127,7 +132,10 @@ public class InvLotLocIdController extends BaseController {
     @PostMapping("/moveEmptyPalletIn")
     private AjaxResult handleEmptyPalletIn(@RequestParam String locationId) {
         BaseLocationInfo baseLocationInfo = iBucketLocInvService.selectLocationInfo();
-        if (ObjectUtil.isNull(baseLocationInfo)) return AjaxResult.error("baseLocationInfo is null");
+        if (ObjectUtil.isNull(baseLocationInfo)) {
+            log.warn("InvLotLocIdController-handleEmptyPalletIn baseLocationInfo is null");
+            return AjaxResult.error("empty pallet location is full");
+        }
         return move(buildInvLotLocIdMoveForm(locationId, String.valueOf(baseLocationInfo.getId())));
     }
 

+ 4 - 3
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ruoyi.ams.inv.service.impl;
 
 import cn.hutool.core.collection.CollectionUtil;
+import cn.hutool.core.util.NumberUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@@ -207,8 +208,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
                 "source location or target location must be not used");
 
 
-        Boolean isInStock = baseLocationInfoService.verifyLocationIsInStock(locationTo, warehouseId);
-        Assert.isTrue(isInStock, "target location is not empty");
+        Boolean isEmpty = !baseLocationInfoService.verifyLocationIsInStock(locationTo, warehouseId);
+        Assert.isTrue(isEmpty, "target location is not empty");
 
         // 起始和目标库位
         BaseLocationInfo baseLocationFrom = baseLocationInfoService.selectBaseLocationInfoByIdOrNo(locationFrom, warehouseId);
@@ -222,7 +223,7 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
             wcsTask.setLocationFrom(baseLocationFrom.getId().toString());
         }
         if (locationTo != null) {
-            wcsTask.setAreaTo(baseLocationTo.getZoneId() + "");
+            wcsTask.setAreaTo(NumberUtil.toStr(baseLocationTo.getZoneId()));
             wcsTask.setLocationTo(baseLocationTo.getId().toString());
         }
         wcsTask.setState(9L);

+ 4 - 4
warewms-ams/src/main/java/com/ruoyi/ams/xuankuang/service/AgvCallProxyService.java

@@ -92,7 +92,7 @@ public class AgvCallProxyService {
     public void bucketIntoStorage(String palletNo, String materialType,
                                                       String agvSourceLocationId, Double quantity) {
         //1.预备参数设置
-        BaseSku baseSku  = iBaseSkuService.selectBaseSkuByMaterialType(materialType);
+        BaseSku baseSku  = iBaseSkuService.selectSkuByMaterialType(materialType);
         Assert.isTrue(ObjectUtil.isNotNull(baseSku) && StringUtils.isNotBlank(baseSku.getSku()), "the materialType is illegal");
         String asnNo = idSequenceUtils.generateId(Constant.ID_TYPE.ASNNO.getDesc());
         Assert.isTrue(ObjectUtil.isNotNull(quantity) && quantity > 0, "quantity is illegal");
@@ -136,7 +136,7 @@ public class AgvCallProxyService {
     public void bucketOutOfStorage(String materialType, String targetLocationId, Double quantity) {
 
         //1.预备参数设置
-        BaseSku baseSku  = iBaseSkuService.selectBaseSkuByMaterialType(materialType);
+        BaseSku baseSku  = iBaseSkuService.selectSkuByMaterialType(materialType);
         Assert.isTrue(ObjectUtil.isNotNull(baseSku) && StringUtils.isNotBlank(baseSku.getSku()), "the materialType is illegal");
         String orderNo = idSequenceUtils.generateId(Constant.ID_TYPE.ORDERNO.getDesc());
         Assert.isTrue(ObjectUtil.isNotNull(quantity) && quantity > 0, "quantity is illegal");
@@ -236,8 +236,8 @@ public class AgvCallProxyService {
 
 
     private WcsResponseVo noticeBucketOutLocTask(String taskNo, String bucketCacheLocationId, String orderNo, String materialType, Double quantity, BaseLocationInfo baseLocationInfo) {
-        BaseSku baseSku = iBaseSkuService.selectBaseSkuByMaterialType(materialType);
-        Assert.isTrue(ObjectUtil.isNotNull(baseSku), "baseSku is null");
+        BaseSku baseSku = iBaseSkuService.selectSkuByMaterialType(materialType);
+        Assert.isTrue(ObjectUtil.isNotNull(baseSku) && StringUtils.isNotBlank(baseSku.getSku()) , "baseSku is null");
         //1.生成一个wcs任务
         String locationInfoId = String.valueOf(baseLocationInfo.getId());
         addWcsOutTask(taskNo, locationInfoId, bucketCacheLocationId, orderNo, 10L, "桶装料出库任务", Constant.TaskType.RGV.getDesc());

+ 9 - 2
warewms-base/src/main/java/com/ruoyi/base/service/IBaseSkuService.java

@@ -1,9 +1,9 @@
 package com.ruoyi.base.service;
 
-import java.util.List;
-
 import com.ruoyi.base.domain.BaseSku;
 
+import java.util.List;
+
 /**
  * 物料信息Service接口
  *
@@ -81,4 +81,11 @@ public interface IBaseSkuService {
      * @return
      */
     List<BaseSku> querySkuList();
+
+    /**
+     * 查询通过物料类型查询sku信息
+     * @param materialType
+     * @return
+     */
+    BaseSku selectSkuByMaterialType(String materialType);
 }

+ 13 - 6
warewms-base/src/main/java/com/ruoyi/base/service/impl/BaseSkuServiceImpl.java

@@ -1,15 +1,15 @@
 package com.ruoyi.base.service.impl;
 
-import java.util.List;
-
+import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ruoyi.base.domain.BaseSku;
+import com.ruoyi.base.mapper.BaseSkuMapper;
+import com.ruoyi.base.service.IBaseSkuService;
 import com.ruoyi.common.utils.DateUtils;
-import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import com.ruoyi.base.mapper.BaseSkuMapper;
-import com.ruoyi.base.domain.BaseSku;
-import com.ruoyi.base.service.IBaseSkuService;
+
+import java.util.List;
 
 /**
  * 物料信息Service业务层处理
@@ -115,4 +115,11 @@ public class BaseSkuServiceImpl implements IBaseSkuService
     public List<BaseSku> querySkuList() {
         return baseSkuMapper.selectList(Wrappers.emptyWrapper());
     }
+
+    @Override
+    public BaseSku selectSkuByMaterialType(String materialType) {
+        List<BaseSku> baseSkuList =
+                baseSkuMapper.selectList(Wrappers.<BaseSku>lambdaQuery().eq(BaseSku::getDesc2, materialType));
+        return CollectionUtil.isNotEmpty(baseSkuList)? baseSkuList.get(0) : new BaseSku() ;
+    }
 }