diff --git a/src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java b/src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java
index 64e8768..c50ed7c 100644
--- a/src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java
+++ b/src/main/java/com/huaheng/api/wcs/controller/WarecellAllocation.java
@@ -33,13 +33,17 @@ public class WarecellAllocation extends BaseController {
     @ApiOperation(value="wcs仓位分配", notes="wcs仓位分配", httpMethod = "POST")
     @ResponseBody
     @ApiLogger(apiName = "仓位分配", from="WCS")
-    public AjaxResult WarecellAllocation(String taskNo, String length, String width, String height, String weight, String destination, String locationType) {
+    /*
+
+     */
+    public AjaxResult WarecellAllocation(String taskNo, String length, String width, String height, String weight, String destination, String locationType, String warehouseCode) {
         WcsTask wcsTask = new WcsTask();
         wcsTask.setTaskNo(taskNo);
         wcsTask.setLength(length);
         wcsTask.setWidth(width);
         wcsTask.setHeight(height);
         wcsTask.setWeight(weight);
+        wcsTask.setWarehouseCode(warehouseCode);
         wcsTask.setDestination(destination);
         wcsTask.setLocationType(locationType);
         AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
diff --git a/src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java
index 0cf956d..21951ca 100644
--- a/src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java
+++ b/src/main/java/com/huaheng/api/wcs/service/taskAssignService/TaskAssignServiceImpl.java
@@ -266,14 +266,14 @@ public class TaskAssignServiceImpl implements TaskAssignService {
         String url=addressService.selectAddress(param)+"TaskAssign";
         String JsonParam = JSON.toJSONString(wcsTask);
         System.out.println(JsonParam);
-        String result = HttpUtils.bodypost(url, JsonParam);
-        if(StringUtils.isEmpty(result)){
-            throw new ServiceException("接口地址错误或返回为空");
-        }
-        AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
-        if(ajaxResult.getCode()!=200){
-            throw new ServiceException(ajaxResult.getMsg());
-        }
-        return ajaxResult;
+//        String result = HttpUtils.bodypost(url, JsonParam);
+//        if(StringUtils.isEmpty(result)){
+//            throw new ServiceException("接口地址错误或返回为空");
+//        }
+//        AjaxResult ajaxResult = JSON.parseObject(result, AjaxResult.class);
+//        if(ajaxResult.getCode()!=200){
+//            throw new ServiceException(ajaxResult.getMsg());
+//        }
+        return AjaxResult.success("123");
     }
 }
diff --git a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationService.java b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationService.java
new file mode 100644
index 0000000..22509ff
--- /dev/null
+++ b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationService.java
@@ -0,0 +1,12 @@
+package com.huaheng.api.wcs.service.warecellAllocation;
+
+import com.huaheng.pc.config.locationType.domain.LocationType;
+
+import java.util.List;
+
+public interface LocationAllocationService {
+
+   String allocation(String locationRule, String roadWay, String warehouseCode, List<LocationType> locationTypeList);
+
+
+}
diff --git a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
new file mode 100644
index 0000000..0513fcb
--- /dev/null
+++ b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
@@ -0,0 +1,102 @@
+package com.huaheng.api.wcs.service.warecellAllocation;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.huaheng.common.exception.service.ServiceException;
+import com.huaheng.common.utils.StringUtils;
+import com.huaheng.pc.config.location.domain.Location;
+import com.huaheng.pc.config.location.service.LocationService;
+import com.huaheng.pc.config.locationType.domain.LocationType;
+import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+public class LocationAllocationServiceImpl implements LocationAllocationService {
+
+    @Resource
+    private LocationService locationService;
+    @Resource
+    private TaskHeaderService taskHeaderService;
+
+    @Override
+    public String allocation(String locationRule, String roadWay, String warehouseCode, List<LocationType> locationTypeList) {
+        if (StringUtils.isEmpty(locationRule)) {
+            return null;
+        }
+        switch (locationRule) {
+            case "DoubleRK":
+                return doubleRk(roadWay, warehouseCode, locationTypeList);
+            case "SingleRK":
+                return singleRk(roadWay, warehouseCode, locationTypeList);
+        }
+        return null;
+    }
+
+    /*
+     * 双伸位库位入库分配库位
+     */
+    private String doubleRk(String roadWay, String warehouseCode, List<LocationType> locationTypeList) {
+        LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery();
+        locationLambda.eq(Location::getRoadway, roadWay).
+                eq(Location::getWarehouseCode, warehouseCode)
+                .eq(Location::getStatus, "empty")
+                .eq(Location::getRowFlag, 1)
+                .eq(Location::getContainerCode, "");
+        List<Location> locationList = locationService.list(locationLambda);
+        List<Location> removeLocaationList = new ArrayList<>();
+        for (Location location1 : locationList) {
+            if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) {
+                removeLocaationList.add(location1);
+            } else {
+                break;
+            }
+        }
+        locationList.removeAll(removeLocaationList);
+        if (locationList == null || locationList.size() == 0) {
+            locationLambda = Wrappers.lambdaQuery();
+            locationLambda.eq(Location::getRoadway, roadWay).
+                    eq(Location::getWarehouseCode, warehouseCode)
+                    .eq(Location::getStatus, "empty")
+                    .eq(Location::getRowFlag, 0)
+                    .eq(Location::getContainerCode, "");
+            locationList = locationService.list(locationLambda);
+            removeLocaationList = new ArrayList<>();
+            for (Location location1 : locationList) {
+                if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) {
+                    removeLocaationList.add(location1);
+                } else {
+                    break;
+                }
+            }
+            locationList.removeAll(removeLocaationList);
+        }
+        String locationCode =  filter(locationList, locationTypeList, roadWay);
+        return locationCode;
+    }
+
+    private String singleRk(String roadWay, String warehouseCode, List<LocationType> locationTypeList) {
+        LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery();
+        locationLambda.eq(Location::getRoadway, roadWay).
+                eq(Location::getWarehouseCode, warehouseCode)
+                .eq(Location::getStatus, "empty")
+                .eq(Location::getContainerCode, "");
+        List<Location> locationList = locationService.list(locationLambda);
+        String locationCode =  filter(locationList, locationTypeList, roadWay);
+        return locationCode;
+    }
+
+    private String filter(List<Location> locationList, List<LocationType> locationTypeList, String roadway) {
+        List<String> codeList = locationTypeList.stream().map(t -> t.getCode()).collect(Collectors.toList());
+        List<Location> newLocation = locationList.stream().filter(t -> codeList.contains(t.getLocationType()) && t.getRoadway().equals(roadway)).collect(Collectors.toList());
+        if (newLocation.isEmpty()) {
+            return null;
+        } else {
+            return newLocation.get(0).getCode();
+        }
+    }
+}
diff --git a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
index ff6ba1b..4f712a6 100644
--- a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
+++ b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/WarecellAllocationServiceImpl.java
@@ -12,6 +12,10 @@ import com.huaheng.pc.config.FilterConfigDetail.domain.FilterConfigDetail;
 import com.huaheng.pc.config.FilterConfigDetail.service.FilterConfigDetailService;
 import com.huaheng.pc.config.configValue.domain.ConfigValue;
 import com.huaheng.pc.config.configValue.service.ConfigValueService;
+import com.huaheng.pc.config.container.domain.Container;
+import com.huaheng.pc.config.container.service.ContainerService;
+import com.huaheng.pc.config.containerType.domain.ContainerType;
+import com.huaheng.pc.config.containerType.service.ContainerTypeService;
 import com.huaheng.pc.config.location.domain.Location;
 import com.huaheng.pc.config.location.service.LocationService;
 import com.huaheng.pc.config.locationType.domain.LocationType;
@@ -50,6 +54,10 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
     @Resource
     private LocationService locationService;
     @Resource
+    private ContainerService containerService;
+    @Resource
+    private ContainerTypeService containerTypeService;
+    @Resource
     private ConfigValueService configValueService;
     @Resource
     private ReceiptPreferenceService receiptPreferenceService;
@@ -73,6 +81,8 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
     private WorkTaskService workTaskService;
     @Resource
     private TransferTaskService transferTaskService;
+    @Resource
+    private LocationAllocationService locationAllocationService;
 
     /**
      * 立库仓位分配
@@ -126,12 +136,8 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
                 .gt(LocationType::getWidth, wcsTask.getWidth())
                 .gt(LocationType::getHeight, wcsTask.getHeight())
                 .gt(LocationType::getMaxWeight, wcsTask.getWidth())
-                .eq(LocationType::getWarehouseCode, ShiroUtils.getWarehouseCode());
+                .eq(LocationType::getWarehouseCode, wcsTask.getWarehouseCode());
         List<LocationType> locationTypeList = locationTypeService.list(lambdaQueryWrapper);
-        List<String> codeList = new ArrayList<>();
-        for (LocationType locationType : locationTypeList) {
-            codeList.add(locationType.getCode());
-        }
 
         String locationCode = null;
         //查询任务明细
@@ -143,7 +149,25 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
         if (taskHeader.getStatus() == 100) {
             return AjaxResult.error("任务已经完成,不能再分库位");
         }
-
+        String containerCode = taskHeader.getContainerCode();
+        LambdaQueryWrapper<Container> containerLambdaQueryWrapper = Wrappers.lambdaQuery();
+        containerLambdaQueryWrapper.eq(Container::getCode, containerCode)
+                                        .eq(Container::getWarehouseCode, wcsTask.getWarehouseCode());
+        Container container = containerService.getOne(containerLambdaQueryWrapper);
+        LambdaQueryWrapper<ContainerType> containerTypeLambdaQueryWrapper = Wrappers.lambdaQuery();
+        containerTypeLambdaQueryWrapper.eq(ContainerType::getCode, container.getContainerType())
+                .eq(ContainerType::getWarehouseCode, wcsTask.getWarehouseCode());
+        ContainerType containerType = containerTypeService.getOne(containerTypeLambdaQueryWrapper);
+        String locationType = containerType.getLocationType();
+        locationTypeList = new ArrayList<>();
+        String[] list = locationType.split(",");
+        for(String str : list) {
+            LambdaQueryWrapper<LocationType> locationTypeLambdaQueryWrapper = Wrappers.lambdaQuery();
+            locationTypeLambdaQueryWrapper.eq(LocationType::getWarehouseCode, wcsTask.getWarehouseCode())
+                                        .eq(LocationType::getCode, str);
+            LocationType locationType1 = locationTypeService.getOne(locationTypeLambdaQueryWrapper);
+            locationTypeList.add(locationType1);
+        }
         /* 循环查询入库组盘明细*/
         List<ReceiptContainerDetail> receiptContainerDetailList = new ArrayList<>();
         for (TaskDetail taskDetail : taskDetailList) {
@@ -157,52 +181,18 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
         if (StringUtils.isEmpty(locatingRule)) {
             //物料类别中定位规则为空时,查询入库首选项
             LambdaQueryWrapper<ConfigValue> configValueLambda = Wrappers.lambdaQuery();
-            configValueLambda.eq(ConfigValue::getWarehouseCode, ShiroUtils.getWarehouseCode())
+            configValueLambda.eq(ConfigValue::getWarehouseCode, wcsTask.getWarehouseCode())
                     .eq(ConfigValue::getModuleType, "receipt")
                     .eq(ConfigValue::getRecordType, "入库首选项");
             ConfigValue configValue = configValueService.getOne(configValueLambda);
             LambdaQueryWrapper<ReceiptPreference> receiptPreferenceLambda = Wrappers.lambdaQuery();
             receiptPreferenceLambda.eq(ReceiptPreference::getCode, configValue.getValue())
-                    .eq(ReceiptPreference::getWarehouseCode, ShiroUtils.getWarehouseCode());
+                    .eq(ReceiptPreference::getWarehouseCode, wcsTask.getWarehouseCode());
             ReceiptPreference receiptPreference = receiptPreferenceService.getOne(receiptPreferenceLambda);
             locatingRule = receiptPreferenceService.getOne(receiptPreferenceLambda).getLocationRule();
         }
-        LambdaQueryWrapper<FilterConfigDetail> filterConfigDetailLambda = Wrappers.lambdaQuery();
-        filterConfigDetailLambda.eq(FilterConfigDetail::getCode, locatingRule)
-                .eq(FilterConfigDetail::getWarehouseCode, ShiroUtils.getWarehouseCode());
-        FilterConfigDetail filterConfigDetail = filterConfigDetailService.getOne(filterConfigDetailLambda);
-        String[] locatingRules = filterConfigDetail.getStatement().split("cut");
-
-        //根据定位规则查询库位编码
-        LambdaQueryWrapper<Location> locationLambda = Wrappers.lambdaQuery();
-        locationLambda.last(locatingRules[0]);
-        locationLambda.eq(Location::getRoadway, wcsTask.getDestination());
-        locationLambda.eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode());
-        List<Location> locationList = locationService.list(locationLambda);
-        List<Location> removeLocaationList = new ArrayList<>();
-        for (Location location1 : locationList) {
-            if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) {
-                removeLocaationList.add(location1);
-            } else {
-                break;
-            }
-        }
-        locationList.removeAll(removeLocaationList);
-        if (locationList == null || locationList.size() == 0) {
-            locationLambda.last(locatingRules[1]);
-            locationList = locationService.list(locationLambda);
-            removeLocaationList = new ArrayList<>();
-            for (Location location1 : locationList) {
-                if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) {
-                    removeLocaationList.add(location1);
-                } else {
-                    break;
-                }
-            }
-            locationList.removeAll(removeLocaationList);
-        }
 
-        locationCode = filter(locationList, locationTypeList, wcsTask.getDestination());
+        locationCode = locationAllocationService.allocation(locatingRule, wcsTask.getDestination(), wcsTask.getWarehouseCode(), locationTypeList);
         if (StringUtils.isEmpty(locationCode)) {
             throw new ServiceException("没有库位可分配");
         }
@@ -228,7 +218,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
                 //把库位编码赋到该入库组盘头表下的所有明细
                 LambdaQueryWrapper<ReceiptContainerDetail> lambda = Wrappers.lambdaQuery();
                 lambda.eq(ReceiptContainerDetail::getReceiptContainerId, receiptContainerHeader.getId())
-                        .eq(ReceiptContainerDetail::getWarehouseCode, ShiroUtils.getWarehouseCode());
+                        .eq(ReceiptContainerDetail::getWarehouseCode, wcsTask.getWarehouseCode());
                 List<ReceiptContainerDetail> receiptContainerDetails = receiptContainerDetailService.list(lambda);
                 for (ReceiptContainerDetail receiptContainerDetail2 : receiptContainerDetails) {
                     receiptContainerDetail2.setLocationCode(locationCode);
@@ -239,45 +229,43 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
             }
         }
 
-        if (StringUtils.isNotEmpty(locationCode)) {
-            //修改任务明细目标库位
-            for (TaskDetail taskDetail : taskDetailList) {
-                taskDetail.setToLocation(locationCode);
-                if (!taskDetailService.updateById(taskDetail)) {
-                    throw new ServiceException("更新任务明细目标库位失败");
-                }
-            }
-            LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
-            locationLambdaQueryWrapper.eq(Location::getCode, locationCode);
-            Location location = locationService.getOne(locationLambdaQueryWrapper);
-            int rowFlag = location.getRowFlag().intValue();
-            Integer preTaskNo = 0;
-            //如果是外侧库位,那么就要判断该库位对应的内侧库位是不是有托盘
-            if (rowFlag == 1) {
-                Location insideLocation = locationService.getInsideNear(location);
-                if (StringUtils.isNotEmpty(insideLocation.getContainerCode())) {
-                    Location destinationLocation = locationService.getEmptyLocation(insideLocation);
-                    AjaxResult ajaxResult = transferTaskService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode());
-                    preTaskNo = (Integer) ajaxResult.getData();
-                    if (ajaxResult.hasErr()) {
-                        throw new ServiceException("创建移库任务失败");
-                    }
-                    taskHeaderService.sendTaskToWcs(Convert.toIntArray(String.valueOf(preTaskNo)));
-                }
+        for (TaskDetail taskDetail : taskDetailList) {
+            taskDetail.setToLocation(locationCode);
+            if (!taskDetailService.updateById(taskDetail)) {
+                throw new ServiceException("更新任务明细目标库位失败");
             }
+        }
 
-            taskHeader.setPreTaskNo(preTaskNo);
-            taskHeader.setToLocation(locationCode);
-            if (!taskHeaderService.updateById(taskHeader)) {
-                throw new ServiceException("更新任务头表目标库位失败");
+        //修改任务明细目标库位
+        LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
+        locationLambdaQueryWrapper.eq(Location::getCode, locationCode)
+                                    .eq(Location::getWarehouseCode, wcsTask.getWarehouseCode());
+        Location location = locationService.getOne(locationLambdaQueryWrapper);
+        int rowFlag = location.getRowFlag().intValue();
+        Integer preTaskNo = 0;
+        //如果是外侧库位,那么就要判断该库位对应的内侧库位是不是有托盘
+        if (rowFlag == 1) {
+            Location insideLocation = locationService.getInsideNear(location);
+            if (StringUtils.isNotEmpty(insideLocation.getContainerCode())) {
+                Location destinationLocation = locationService.getEmptyLocation(insideLocation);
+                AjaxResult ajaxResult = transferTaskService.createTransferTask(insideLocation.getCode(), destinationLocation.getCode());
+                preTaskNo = (Integer) ajaxResult.getData();
+                if (ajaxResult.hasErr()) {
+                    throw new ServiceException("创建移库任务失败");
+                }
+                taskHeaderService.sendTaskToWcs(Convert.toIntArray(String.valueOf(preTaskNo)));
             }
-            WCSInfo wcsInfo = new WCSInfo();
-            wcsInfo.setLocationCode(locationCode);
-            wcsInfo.setPreTask(String.valueOf(preTaskNo));
-            return AjaxResult.success().setData(wcsInfo);
         }
 
-        return AjaxResult.error("错误");
+        taskHeader.setPreTaskNo(preTaskNo);
+        taskHeader.setToLocation(locationCode);
+        if (!taskHeaderService.updateById(taskHeader)) {
+            throw new ServiceException("更新任务头表目标库位失败");
+        }
+        WCSInfo wcsInfo = new WCSInfo();
+        wcsInfo.setLocationCode(locationCode);
+        wcsInfo.setPreTask(String.valueOf(preTaskNo));
+        return AjaxResult.success().setData(wcsInfo);
     }
 
     /**
@@ -412,4 +400,5 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
         String destinationArea = location.getRoadway();
         return AjaxResult.success(destinationArea);
     }
+
 }
\ No newline at end of file
diff --git a/src/main/java/com/huaheng/pc/task/taskHeader/service/ShipmentTaskService.java b/src/main/java/com/huaheng/pc/task/taskHeader/service/ShipmentTaskService.java
index dac8a9c..0b676ec 100644
--- a/src/main/java/com/huaheng/pc/task/taskHeader/service/ShipmentTaskService.java
+++ b/src/main/java/com/huaheng/pc/task/taskHeader/service/ShipmentTaskService.java
@@ -257,9 +257,7 @@ public class ShipmentTaskService {
             inventoryHeader= inventoryHeaderService.getOne(lambdaQueryWrapper);
             if(inventoryHeader != null) {
                 String locationCode = inventoryHeader.getLocationCode();
-                LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
-                locationLambdaQueryWrapper.eq(Location::getCode, locationCode);
-                Location location = locationService.getOne(locationLambdaQueryWrapper);
+                Location location = locationService.findLocationByCode(locationCode);
                 location.setContainerCode("");
                 location.setStatus("empty");
                 locationService.updateById(location);