diff --git a/src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java b/src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
index 6e45ffd..6d00526 100644
--- a/src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
+++ b/src/main/java/com/huaheng/api/wcs/service/overrideHandle/OverrideHandleServiceImpl.java
@@ -147,7 +147,7 @@ public class OverrideHandleServiceImpl implements OverrideHandleService {
             }
         }
 
-        String locationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, onlyEmptyContainer, isSelfCreated, isFlammable);
+        String locationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, onlyEmptyContainer, isSelfCreated, isFlammable, false);
         if (StringUtils.isEmpty(locationCode)) {
             return AjaxResult.error("没有库位可分配");
         }
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 cd31216..b135e48 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
@@ -170,7 +170,7 @@ public class TaskAssignServiceImpl implements TaskAssignService {
                             }
                             //分配库位
                             String destinationLocationCode = locationAllocationService.allocation(insideLocation.getHigh(), insideLocation.getArea(), "5",
-                                    containerCode, insideLocation.getFrequencyLocation(), insideLocation.getOnlyEmptyContainer(), isSelfCreated, isFlammable);
+                                    containerCode, insideLocation.getFrequencyLocation(), insideLocation.getOnlyEmptyContainer(), isSelfCreated, isFlammable, true);
                             if (StringUtils.isEmpty(destinationLocationCode)) {
                                 return AjaxResult.error("移库没有剩余库位");
                             } else if (destinationLocationCode.length() > 10) {
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
index 05ff145..913dbd5 100644
--- a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationService.java
+++ b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationService.java
@@ -9,9 +9,9 @@ public interface LocationAllocationService {
 
 
     String allocation(int high, String area, String roadWay, String containerCode, Integer frequencyLocation,
-                      Integer emptyContainerTask, Integer isSelfCreated, boolean isFlammable);
+                      Integer emptyContainerTask, Integer isSelfCreated, boolean isFlammable, boolean transfer);
 
-    String fiveStacker(int high, String containerCode, boolean isFlammable);
+    String fiveStacker(int high, String containerCode, boolean isFlammable, boolean transfer);
 
     void setTemporaryLocationType(Location location, boolean isBigContainer);
 
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
index 14a4ca2..17d6a4f 100644
--- a/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
+++ b/src/main/java/com/huaheng/api/wcs/service/warecellAllocation/LocationAllocationServiceImpl.java
@@ -19,6 +19,7 @@ import com.huaheng.pc.config.locationType.service.LocationTypeService;
 import com.huaheng.pc.config.zone.domain.Zone;
 import com.huaheng.pc.config.zone.service.ZoneService;
 import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
+import io.undertow.util.Transfer;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StopWatch;
@@ -55,13 +56,12 @@ public class LocationAllocationServiceImpl implements LocationAllocationService 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String allocation(int high, String area, String roadWay, String containerCode, Integer frequencyLocation,
-                             Integer emptyContainerTask, Integer isSelfCreated, boolean isFlammable) {
+                             Integer emptyContainerTask, Integer isSelfCreated, boolean isFlammable, boolean transfer) {
 
         //二期5号巷道
         if (roadWay.equals(DYNAMIC_ROADWAY)) {
-            return locationAllocationService.fiveStacker(high, containerCode, isFlammable);
-            //自建单据
-        } else if (isSelfCreated == 1) {
+            return locationAllocationService.fiveStacker(high, containerCode, isFlammable, transfer);
+        } else if (isSelfCreated == 1) { //自建单据
             return locationAllocationService.isSelfCreated(roadWay, high, frequencyLocation, isFlammable);
         } else {
             return locationAllocationService.doubleRk(area, roadWay, high, frequencyLocation, emptyContainerTask, isFlammable);
@@ -73,11 +73,14 @@ public class LocationAllocationServiceImpl implements LocationAllocationService 
     //分配库位排序,(层-外侧-内侧-列)
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public String fiveStacker(int high, String containerCode, boolean isFlammable) {
+    public String fiveStacker(int high, String containerCode, boolean isFlammable, boolean transfer) {
         Container container = containerService.getOne(new LambdaQueryWrapper<Container>().eq(Container::getCode, containerCode));
         String containerType = container.getContainerType();
         //判断预留库位
-        int reserveNumber = getDynamicReserveNumber();
+        int reserveNumber = 0;
+        if (!transfer) {//不是移库
+            reserveNumber = getDynamicReserveNumber();
+        }
         LambdaQueryWrapper<Location> wrapper = Wrappers.lambdaQuery();
         wrapper
                 .eq(Location::getRoadway, DYNAMIC_ROADWAY)
@@ -106,27 +109,57 @@ public class LocationAllocationServiceImpl implements LocationAllocationService 
         });
         list.sort(Comparator.comparingInt(Location::getRowFlag).reversed());
 
-        //大托盘占两个库位
+        //大托盘占两个库位,只放奇数列,且右侧有空库位,且当前库位类型不是小托盘
+        List<Location> bigContainerLocations = new ArrayList<>();
         if (containerType.equals(CONTAINER_TYPE_X) || containerType.equals(CONTAINER_TYPE_W)) {
-            for (Location location : list) {
-                //大托盘只放奇数列,且右侧有空库位,且当前库位类型不是小托盘
-                if (location.getIColumn() % 2 != 0 && !location.getTemporaryType().startsWith(SMALL_CONTAINER_TYPE)) {
-                    Location rightLocation = locationService.getRightEmptyLocation(location);
-                    if (rightLocation != null) {
-                        //禁用库位
-                        int updateCount = locationService.updateStatusNew(rightLocation.getCode(), DEFAULT_WAREHOUSE, STATUS_LOCATION_DISABLE, STATUS_LOCATION_EMPTY);
-                        if (updateCount != 1) {
-                            throw new ServiceException("分配库位时,禁用库位失败");
-                        }
-                        if (location.getTemporaryType().equals(UNDEFINED_CONTAINER_TYPE)) {
-                            //设置相邻临时库位类型
-                            locationAllocationService.setTemporaryLocationType(location, true);
-                        }
-                        return location.getCode();
-                    }
+            List<Location> filteredLocations = list.stream()
+                    .filter(location -> location.getIColumn() % 2 != 0 && !location.getTemporaryType().startsWith(SMALL_CONTAINER_TYPE)).collect(Collectors.toList());
+
+            for (Location filteredLocation : filteredLocations) {
+                Location rightLocation = locationService.getRightEmptyLocation(filteredLocation);
+                if (rightLocation != null) {
+                    bigContainerLocations.add(filteredLocation);
                 }
             }
-            return null;
+            if (bigContainerLocations.isEmpty()) {
+                return null;
+            }
+            if (!transfer && bigContainerLocations.size() <= 4) {//留4个大托盘库位移库用
+                return "可能是大托盘库位不够用了";
+            }
+            //todo 也可以在这里排序
+            Location location = bigContainerLocations.get(0);
+            Location rightLocation = locationService.getRightEmptyLocation(location);
+            //禁用库位
+            int updateCount = locationService.updateStatusNew(rightLocation.getCode(), DEFAULT_WAREHOUSE, STATUS_LOCATION_DISABLE, STATUS_LOCATION_EMPTY);
+            if (updateCount != 1) {
+                throw new ServiceException("分配库位时,禁用库位失败");
+            }
+            //设置相邻临时库位类型
+            if (location.getTemporaryType().equals(UNDEFINED_CONTAINER_TYPE)) {
+                locationAllocationService.setTemporaryLocationType(location, true);
+            }
+            return location.getCode();
+
+            //for (Location location : list) {
+            //    //大托盘只放奇数列,且右侧有空库位,且当前库位类型不是小托盘
+            //    if (location.getIColumn() % 2 != 0 && !location.getTemporaryType().startsWith(SMALL_CONTAINER_TYPE)) {
+            //        Location rightLocation = locationService.getRightEmptyLocation(location);
+            //        if (rightLocation != null) {
+            //            //禁用库位
+            //            int updateCount = locationService.updateStatusNew(rightLocation.getCode(), DEFAULT_WAREHOUSE, STATUS_LOCATION_DISABLE, STATUS_LOCATION_EMPTY);
+            //            if (updateCount != 1) {
+            //                throw new ServiceException("分配库位时,禁用库位失败");
+            //            }
+            //            if (location.getTemporaryType().equals(UNDEFINED_CONTAINER_TYPE)) {
+            //                //设置相邻临时库位类型
+            //                locationAllocationService.setTemporaryLocationType(location, true);
+            //            }
+            //            return location.getCode();
+            //        }
+            //    }
+            //}
+            //return null;
         } else {
             //分配小托盘库位,将大托盘库位过滤掉
             //小托盘不分配25列,最好让大托盘放在25列
@@ -149,10 +182,12 @@ public class LocationAllocationServiceImpl implements LocationAllocationService 
         if (list.isEmpty()) {
             return null;
         }
-
-        Location location = list.stream().findFirst().orElse(null);
+        if (list.size() <= reserveNumber) {
+            return "可能是小托盘库位不够用了";
+        }
+        Location location = list.get(0);
+        //设置相邻临时库位类型
         if (location.getTemporaryType().equals(UNDEFINED_CONTAINER_TYPE)) {
-            //设置相邻临时库位类型
             locationAllocationService.setTemporaryLocationType(location, false);
         }
         return location.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 dbd1dc1..d8332bf 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
@@ -129,10 +129,11 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
         if (StringUtils.isNull(warecellDomain.getWidth())) {
             return AjaxResult.error("宽为空");
         }
-        if (StringUtils.isNull(warecellDomain.getHeight()) || "0".equals(warecellDomain.getHeight())) {
+        warecellDomain.setWarehouseCode("CS0001");
+        String height = warecellDomain.getHeight();
+        if (StringUtils.isNull(height) || "0".equals(height)) {
             return AjaxResult.error("高为空或0");
         }
-        warecellDomain.setWarehouseCode("CS0001");
         return warecellAllocationService.verticalWarehouseAllocation(warecellDomain);
     }
 
@@ -212,7 +213,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
         //巷道
         String roadWay = roadWays.get(0);
         //分配库位
-        locationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, emptyContainerTask, isSelfCreated, isFlammable);
+        locationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, emptyContainerTask, isSelfCreated, isFlammable, false);
 
         if (StringUtils.isEmpty(locationCode)) {
             return AjaxResult.error("没有库位可分配");
@@ -256,7 +257,7 @@ public class WarecellAllocationServiceImpl implements WarecellAllocationService 
                 Location destinationLocation;
                 if (roadWay.equals("5")) {
                     //分配库位
-                    String destinationLocationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, emptyContainerTask, isSelfCreated, isFlammable);
+                    String destinationLocationCode = locationAllocationService.allocation(high, area, roadWay, containerCode, frequencyLocation, emptyContainerTask, isSelfCreated, isFlammable, true);
                     if (StringUtils.isEmpty(destinationLocationCode)) {
                         return AjaxResult.error("移库没有剩余库位");
                     } else if (destinationLocationCode.length() > 10) {
diff --git a/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java b/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
index 3fa4f3a..09e3017 100644
--- a/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
+++ b/src/main/java/com/huaheng/pc/config/location/service/LocationServiceImpl.java
@@ -750,7 +750,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
         return null;
     }
 
-    //获取库位的左侧空库位,且
+    //获取库位的左侧空库位,且相邻4个库位不能有任务
     @Override
     public Location getRightEmptyLocation(Location location) {
         Location rightEmptyLocation = locationService.getOne(new LambdaQueryWrapper<Location>()
diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
index a280403..f5222f3 100644
--- a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
+++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/controller/ShipmentHeaderController.java
@@ -643,6 +643,7 @@ public class ShipmentHeaderController extends BaseController {
                 String workshops = configService.getKey(AUTO_SHIPMENT_WORKSHOPS);
                 List<ShipmentHeader> shipmentHeaderList = shipmentHeaderService.list(new LambdaQueryWrapper<ShipmentHeader>()
                         .eq(ShipmentHeader::getCreatedBy, "MOM")
+                        .eq(ShipmentHeader::getDeleted, 0)
                         .eq(ShipmentHeader::getAutoShipmentStatus, 0)
                         .eq(ShipmentHeader::getFirstStatus, RECEIPT_HEADER_BUILD)
                         .eq(ShipmentHeader::getLastStatus, RECEIPT_HEADER_BUILD)
@@ -680,7 +681,9 @@ public class ShipmentHeaderController extends BaseController {
 
     //获取待自动执行的出库单
     public List<ShipmentHeader> getPrepareShipmentHeaderList() {
-        return shipmentHeaderService.list(new LambdaQueryWrapper<ShipmentHeader>().eq(ShipmentHeader::getAutoShipmentStatus, 1));
+        return shipmentHeaderService.list(new LambdaQueryWrapper<ShipmentHeader>()
+                .eq(ShipmentHeader::getDeleted, 0)
+                .eq(ShipmentHeader::getAutoShipmentStatus, 1));
     }
 
     //批量修改出库单状态
diff --git a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java
index 4a79a96..e09dac0 100644
--- a/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java
+++ b/src/main/java/com/huaheng/pc/shipment/shipmentHeader/service/ShipmentHeaderServiceImpl.java
@@ -480,7 +480,10 @@ public class ShipmentHeaderServiceImpl extends ServiceImpl<ShipmentHeaderMapper,
     @Override
     public AjaxResult autoBillMerge() {
         //出库单状态是新建的单据,根据通知单号、原仓库、车间都相同都的出库单进行合并。(只合并一次)
-        List<ShipmentHeader> list = shipmentHeaderService.list(new LambdaQueryWrapper<ShipmentHeader>().eq(ShipmentHeader::getFirstStatus, QuantityConstant.SHIPMENT_HEADER_BUILD));
+        List<ShipmentHeader> list = shipmentHeaderService.list(new LambdaQueryWrapper<ShipmentHeader>()
+                .eq(ShipmentHeader::getDeleted, 0)
+                .eq(ShipmentHeader::getLastStatus, QuantityConstant.SHIPMENT_HEADER_BUILD)
+                .eq(ShipmentHeader::getFirstStatus, QuantityConstant.SHIPMENT_HEADER_BUILD));
         // 用于存储相同出库单的映射
         Map<String, List<Integer>> matchingMap = new HashMap<>();
 
diff --git a/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html b/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
index f12ebd6..cd487a0 100644
--- a/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
+++ b/src/main/resources/templates/shipment/shipmentHeader/shipmentHeader.html
@@ -940,7 +940,6 @@
                 } else {
                     $('#shipmentDeleted').val('是')
                 }
-                ;
                 $('#shipmentUserDef1').val(value.data.userDef1);
                 $('#shipmentUserDef2').val(value.data.userDef2);
                 $('#shipmentUserDef3').val(value.data.userDef3);