Kaynağa Gözat

入库分配策略修改

andy 3 yıl önce
ebeveyn
işleme
875a481b6a

+ 11 - 2
ruoyi-admin/src/test/java/com/ruoyi/admin/test/base/WarehouseTest.java

@@ -13,7 +13,9 @@ 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.domain.BaseWarehouse;
+import com.ruoyi.base.domain.LotattVO;
 import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
+import com.ruoyi.base.mapper.BaseLocationInfoMapper;
 import com.ruoyi.base.mapper.BaseSkuMapper;
 import com.ruoyi.base.service.IBaseWarehouseService;
 import com.ruoyi.base.service.SysIdsequenceService;
@@ -50,6 +52,8 @@ public class WarehouseTest {
     private InvLotLocIdMapper invLotLocIdMapper;
     @Autowired
     private LocationViewService locationViewService;
+    @Autowired
+    private BaseLocationInfoMapper baseLocationInfoMapper;
 
     @Test
     public void test() {
@@ -92,8 +96,13 @@ public class WarehouseTest {
 //        arr.add("1");
 //        arr.add("2");
 //        baseSkuMapper.selectBaseSkuBySkuTypeList(null);
-        List<BaseLocationLotattVO> locationList = invLotLocIdMapper.selectInvLocationList(null,null,null,null,null,null);
-        System.out.println(JSON.toJSONString(locationList));
+        //List<BaseLocationLotattVO> locationList = invLotLocIdMapper.selectInvLocationList(null,null,null,null,null,null);
+        /*BaseLocationInfo baseLocationInfo = new BaseLocationInfo();
+        baseLocationInfo.setZoneId(2L);
+        baseLocationInfo.setWarehouseId(1L);
+        List<BaseLocationLotattVO> lotattVOS = baseLocationInfoMapper.selectSortedLocationLotattListByZoneId(baseLocationInfo);*/
+        LotattVO vo = baseLocationInfoMapper.selectInvLotattById(101L);
+        System.out.println(JSON.toJSONString(vo));
     }
 
     @Test

+ 22 - 7
ruoyi-ui/src/views/ams/inv/locationView/index.vue

@@ -27,7 +27,7 @@
       </el-form-item>
     </el-form>
     <el-row>
-      <right-toolbar :showSearch.sync="showSearch" @queryTable="init"></right-toolbar>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="search"></right-toolbar>
     </el-row>
     <div style="overflow-scrolling: auto">
       <ul class="wall-row"
@@ -130,20 +130,35 @@
       },
       lockLoc() {
         lockLocRequest(this.currentSelect).then(response => {
-          this.$modal.msgSuccess(response.msg);
-          this.search();
+          if (response.code === 200) {
+            this.$modal.msgSuccess(response.msg);
+            this.search();
+            this.open = false
+          } else {
+            this.$modal.msgError(response.msg);
+          }
         });
       },
       occupyLoc() {
         occupyLocRequest(this.currentSelect).then(response => {
-          this.$modal.msgSuccess(response.msg);
-          this.init()
+          if (response.code === 200) {
+            this.$modal.msgSuccess(response.msg);
+            this.search();
+            this.open = false
+          } else {
+            this.$modal.msgError(response.msg);
+          }
         });
       },
       clearLoc() {
         clearLocRequest(this.currentSelect).then(response => {
-          this.$modal.msgSuccess(response.msg);
-          this.init()
+          if (response.code === 200) {
+            this.$modal.msgSuccess(response.msg);
+            this.search();
+            this.open = false
+          } else {
+            this.$modal.msgError(response.msg);
+          }
         });
       }
     }

+ 1 - 1
ruoyi-ui/src/views/ams/locationPriority/index.vue

@@ -228,7 +228,7 @@
         <el-form-item label="自定义字段5" prop="userdefine5">
           <el-input v-model="form.userdefine5" placeholder="请输入自定义字段5" />
         </el-form-item>-->
-        <el-divider content-position="center">信息</el-divider>
+        <el-divider content-position="center">库存指定批次属性</el-divider>
         <el-row :gutter="10" class="mb8">
           <el-col :span="1.5">
             <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddLocationPriorityDetails">添加

+ 1 - 0
warewms-ams/src/main/java/com/ruoyi/ams/business/BusinessServiceImpl.java

@@ -91,6 +91,7 @@ public class BusinessServiceImpl implements IBusinessService {
                 outWarehouseDTO.setSku(agvCallDTO.getSku());
                 outWarehouseDTO.setQty(agvCallDTO.getQty());
                 outWarehouseDTO.setWeight(agvCallDTO.getWeight());
+                outWarehouseDTO.setSupplier(agvCallDTO.getSupplier());
                 outWarehouseDTO.setLotattDTO(agvCallDTO.getLotattDTO());
                 outWarehouseDTO.setWarehouseId(agvCallDTO.getWarehouseId());
                 BaseLocationInfo locationFrom = outInvAllocation(outWarehouseDTO);

+ 2 - 0
warewms-ams/src/main/java/com/ruoyi/ams/config/domain/dto/LotattDTO.java

@@ -27,6 +27,8 @@ public class LotattDTO {
     private String lotatt17;
     private String lotatt18;
 
+    private Map<String, String> attMap;
+
     public String getLotatt01() {
         return lotatt01;
     }

+ 26 - 3
warewms-ams/src/main/java/com/ruoyi/ams/config/service/LocationAllocationStrategy.java

@@ -1,12 +1,14 @@
 package com.ruoyi.ams.config.service;
 
 import com.ruoyi.ams.config.domain.dto.InWarehouseDTO;
+import com.ruoyi.ams.config.domain.dto.LotattDTO;
 import com.ruoyi.ams.config.domain.dto.OutWarehouseDTO;
 import com.ruoyi.ams.config.domain.vo.LocationPriorityDetailsVO;
 import com.ruoyi.ams.config.domain.vo.LocationPriorityHeaderVO;
 import com.ruoyi.ams.config.mapper.LocationPriorityHeaderMapper;
 import com.ruoyi.ams.inv.mapper.InvLotLocIdMapper;
 import com.ruoyi.base.domain.BaseLocationInfo;
+import com.ruoyi.base.domain.LotattVO;
 import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
 import com.ruoyi.base.mapper.BaseLocationInfoMapper;
 import org.springframework.beans.BeanUtils;
@@ -99,6 +101,22 @@ public class LocationAllocationStrategy {
                 lotatt.put(vo.getLotattId(), vo.getLotattValue());
             }
         }
+        //如果策略配置了入库的属性那么选择相同属性的库位进行存放
+        if (lotatt.size() > 0 && inWarehouseDTO.getLotattDTO() != null) {
+            LotattDTO lotattDTO = inWarehouseDTO.getLotattDTO();
+            lotattDTO.getAttr();
+            boolean isSame = true;
+            for (Map.Entry<String, String> attEntry : lotatt.entrySet()) {
+                if (lotattDTO.getAttr().get(attEntry.getKey()) != null) {
+                    if (!lotattDTO.getAttr().get(attEntry.getKey()).equals(attEntry.getValue())) {
+                        isSame = false;
+                    }
+                }
+            }
+            if (isSame == false) {
+                return null;
+            }
+        }
 
         //将同一列的库位排序好
         Integer parallelCount = 0;
@@ -138,8 +156,13 @@ public class LocationAllocationStrategy {
                         continue;
                     }
                 }
-                // TODO 优先寻找匹配批次属性的库存库位进行存放
-                if (lotatt.size() > 0 && b.getLotattVO() != null) { //指定了批次属性的需要对相同批次属性的库存进行匹配
+                // TODO 如果库存中已存在批次属性那么存放相同批次属性的物料
+                /*if (lotatt.size() > 0) { //指定了批次属性的需要对相同批次属性的库存进行匹配
+                    //如果没有批次属性查询是否有待搬运的属性
+                    if (b.getLotattVO() == null) {
+                        LotattVO lotattVO = baseLocationInfoMapper.selectInvLotattById(b.getId());
+                        b.setLotattVO(lotattVO);
+                    }
                     b.initLotatt();
                     boolean isSame = true;
                     for (Map.Entry<String, String> attEntry : lotatt.entrySet()) {
@@ -150,7 +173,7 @@ public class LocationAllocationStrategy {
                     if (isSame == false) {
                         continue;
                     }
-                }
+                }*/
 
                 if (currentLocation == null) {
                     if (b.getIsEmpty().equals("Y") && b.getStockStatus().equals("00")) {

+ 9 - 0
warewms-ams/src/main/java/com/ruoyi/ams/inv/service/impl/InvLotLocIdServiceImpl.java

@@ -14,7 +14,9 @@ import com.ruoyi.base.domain.BaseLocationInfo;
 import com.ruoyi.base.domain.BaseSku;
 import com.ruoyi.base.domain.SysIdsequence;
 import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
+import com.ruoyi.base.mapper.BaseLocationZoneMapper;
 import com.ruoyi.base.mapper.BaseSkuMapper;
+import com.ruoyi.base.service.IBaseLocationInfoService;
 import com.ruoyi.base.service.IBaseSkuService;
 import com.ruoyi.base.service.SysIdsequenceService;
 import com.ruoyi.common.utils.DateUtils;
@@ -41,6 +43,8 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
     private InvLotAttMapper invLotAttMapper;
     @Autowired
     private SysIdsequenceService sysIdsequenceService;
+    @Autowired
+    private IBaseLocationInfoService baseLocationInfoService;
 
     /**
      * 查询库位库存信息
@@ -157,5 +161,10 @@ public class InvLotLocIdServiceImpl implements IInvLotLocIdService {
         invLotLocId.setCreateTime(new Date());
         invLotLocIdMapper.insertInvLotLocId(invLotLocId);
 
+        BaseLocationInfo baseLocationInfo = new BaseLocationInfo();
+        baseLocationInfo.setId(Long.parseLong(locationFrom));
+        baseLocationInfo.setIsEmpty("N");
+        baseLocationInfoService.updateBaseLocationInfo(baseLocationInfo);
+
     }
 }

+ 2 - 0
warewms-ams/src/main/java/com/ruoyi/ams/lineCall/service/impl/LineCallServiceImpl.java

@@ -65,6 +65,7 @@ public class LineCallServiceImpl implements ILineCallService {
                 BaseLocationInfo query = new BaseLocationInfo();
                 query.setWarehouseId(warehouseId);
                 query.setZoneId(Long.parseLong(s));
+                query.setStockStatus("00");
                 List<BaseLocationInfo> bList = baseLocationInfoService.selectBaseLocationInfoList(query);
                 locationFromList.addAll(bList);
             }
@@ -80,6 +81,7 @@ public class LineCallServiceImpl implements ILineCallService {
                 BaseLocationInfo query = new BaseLocationInfo();
                 query.setWarehouseId(warehouseId);
                 query.setZoneId(Long.parseLong(s));
+                query.setStockStatus("00");
                 List<BaseLocationInfo> bList = baseLocationInfoService.selectBaseLocationInfoList(query);
                 locationToList.addAll(bList);
             }

+ 3 - 0
warewms-base/src/main/java/com/ruoyi/base/mapper/BaseLocationInfoMapper.java

@@ -2,6 +2,7 @@ package com.ruoyi.base.mapper;
 
 import java.util.List;
 import com.ruoyi.base.domain.BaseLocationInfo;
+import com.ruoyi.base.domain.LotattVO;
 import com.ruoyi.base.domain.vo.BaseLocationLotattVO;
 import org.apache.ibatis.annotations.Param;
 
@@ -84,6 +85,8 @@ public interface BaseLocationInfoMapper
      */
      List<BaseLocationLotattVO> selectSortedLocationLotattListByZoneId(BaseLocationInfo baseLocationInfo);
 
+     LotattVO selectInvLotattById(@Param("id") Long id);
+
     /**
      *
      * @param id

+ 7 - 0
warewms-base/src/main/resources/mapper/base/BaseLocationInfoMapper.xml

@@ -273,6 +273,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         order by lpad(row_no, 11, '0'),row_index,lpad(shift_no, 11, '0'),shift_index,lpad(col_no, 11, '0'),col_index
     </select>
 
+    <select id="selectInvLotattById" parameterType="Long" resultMap="LotattResult">
+        select att.*
+        from base_location_info b left join wcs_task w on b.id = w.location_to
+        left join inv_lot_loc_id inv on w.location_from = inv.location_id
+        left join inv_lot_att att on inv.lotnum = att.lotnum
+        where b.id = #{id}
+    </select>
 
     <update id="updateLocationStockStatus">
         update base_location_info set stock_status = #{status} where id = #{id}