diff --git a/src/main/java/com/huaheng/pc/config/location/service/LocationService.java b/src/main/java/com/huaheng/pc/config/location/service/LocationService.java
index 4eafe53..2424201 100644
--- a/src/main/java/com/huaheng/pc/config/location/service/LocationService.java
+++ b/src/main/java/com/huaheng/pc/config/location/service/LocationService.java
@@ -114,4 +114,6 @@ public interface LocationService extends IService<Location>{
     int getLastRowOfZone(String warehouseCode, String zoneCode);
 
     public List<Location> remoteList(String type);
+
+    void upstatus(String code);
 }
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 5833476..d932239 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
@@ -2,6 +2,7 @@ package com.huaheng.pc.config.location.service;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.huaheng.common.constant.QuantityConstant;
@@ -24,7 +25,7 @@ import java.text.MessageFormat;
 import java.util.*;
 
 @Service("LocationService")
-public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> implements LocationService{
+public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> implements LocationService {
 
     @Resource
     private LocationService locationService;
@@ -41,17 +42,18 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
      * //新增库位,需要建立code,并判断是否重复
      * 1. 库区和库位没有绝对关系。 先建立库区,然后在库区的位置进行建立库位类型。
      * TODO:胡海--在判断库位类型和库区是否匹配,应该用库位类型表进行判断。库位类型在库区存在即可
+     *
      * @param location
      * @return
      */
     @Override
-    public AjaxResult addsave(Location location){
+    public AjaxResult addsave(Location location) {
 
         //库区与库位类型的匹配判断
-        if(!location.getZoneCode().equals(location.getLocationType())){
-            throw new ServiceException(location.getLocationType()+"的库位类型与"+location.getZoneCode()+"库区不匹配");
+        if (!location.getZoneCode().equals(location.getLocationType())) {
+            throw new ServiceException(location.getLocationType() + "的库位类型与" + location.getZoneCode() + "库区不匹配");
         }
-       //TODO:胡海-- 库位编码长度应该是弹性的,即我们的库位是由4个维度组成的,正常情况下  平库(行列) 立体仓库(行列层) AGV料架库(行列层格)
+        //TODO:胡海-- 库位编码长度应该是弹性的,即我们的库位是由4个维度组成的,正常情况下  平库(行列) 立体仓库(行列层) AGV料架库(行列层格)
         // 这里可以判断下 然后决定库位编码长度。
         //创建库位编码code
         String prefix = location.getLocationType();
@@ -63,9 +65,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
 
         //判断code是否重复
         LambdaQueryWrapper<Location> lam = Wrappers.lambdaQuery();
-        lam.eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode())
-                .eq(Location::getCode,code);
-        if(this.getOne(lam)!=null){
+        lam.eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode())
+                .eq(Location::getCode, code);
+        if (this.getOne(lam) != null) {
             return AjaxResult.error("该位置已有库位生成,请重新输入位置");
         }
 
@@ -73,8 +75,8 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
         location.setCode(code);
         location.setWarehouseCode(ShiroUtils.getWarehouseCode());
         location.setCreatedBy(ShiroUtils.getLoginName());
-        Boolean flag=this.save(location);
-        if(flag == false){
+        Boolean flag = this.save(location);
+        if (flag == false) {
             return AjaxResult.error("新增库位失败,插入数据库时失败");
         }
         return AjaxResult.success("新增库位成功");
@@ -82,6 +84,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
 
     /**
      * 批量新增库位
+     *
      * @param location
      * @return boolean
      */
@@ -89,32 +92,32 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
     public boolean insertLocation(Location location) {
         /* 判断库位类型编码是否存在*/
         LambdaQueryWrapper<LocationType> typeLambda = Wrappers.lambdaQuery();
-        typeLambda.eq(LocationType::getCode,location.getLocationType())
-                        .select(LocationType::getCode);
+        typeLambda.eq(LocationType::getCode, location.getLocationType())
+                .select(LocationType::getCode);
         List<Map<String, Object>> list = locationTypeService.listMaps(typeLambda);
-        if (list.size() < 1){
+        if (list.size() < 1) {
             throw new ServiceException("库位类型编码不存在");
         }
 
         /* 判断库区编码是否存在*/
-        LambdaQueryWrapper<Zone> zoneLambda= Wrappers.lambdaQuery();
+        LambdaQueryWrapper<Zone> zoneLambda = Wrappers.lambdaQuery();
         zoneLambda.eq(Zone::getCode, location.getZoneCode())
                 .select(Zone::getCode);
 
         list = zoneService.listMaps(zoneLambda);
-        if (list.size() < 1){
+        if (list.size() < 1) {
             throw new ServiceException("库区编码不存在");
         }
         //TODO:胡海--在判断库位类型和库区是否匹配,应该用库位类型表进行判断。库位类型在库区存在即可
-        if(!location.getZoneCode().equals(location.getLocationType())){
-            throw new ServiceException(location.getLocationType()+"的库位类型与"+location.getZoneCode()+"库区不匹配");
+        if (!location.getZoneCode().equals(location.getLocationType())) {
+            throw new ServiceException(location.getLocationType() + "的库位类型与" + location.getZoneCode() + "库区不匹配");
         }
 
         List<Location> locations = new ArrayList<>();
-        for (int i=1; i<=location.getIRow().intValue(); i++)  {
-            for (int j=1; j<=location.getIColumn().intValue(); j++)  {
-                for (int k=1; k<=location.getILayer().intValue(); k++)  {
-                    for (int m=1; m<=location.getIGrid().intValue(); m++)  {
+        for (int i = 1; i <= location.getIRow().intValue(); i++) {
+            for (int j = 1; j <= location.getIColumn().intValue(); j++) {
+                for (int k = 1; k <= location.getILayer().intValue(); k++) {
+                    for (int m = 1; m <= location.getIGrid().intValue(); m++) {
                         //Integer roadway = (j / 2) + 1;
                         Location param = new Location();
                         param.setIRow(i);
@@ -135,8 +138,8 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
                                 String.format("%02d", k));
                         //查询该库位编码是否存在
                         LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery();
-                        queryWrapper.eq(Location::getCode,code)
-                                .eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode());
+                        queryWrapper.eq(Location::getCode, code)
+                                .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode());
                         List<Location> locationList = locationService.list(queryWrapper);
                         if (locationList.size() == 0) {
                             param.setCode(code);
@@ -146,38 +149,38 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
                 }
             }
         }
-        int num =0;
+        int num = 0;
         List<Location> locations1 = new ArrayList<>();
-        if(locations.size() >1000 ){
-            for(Location item : locations){
+        if (locations.size() > 1000) {
+            for (Location item : locations) {
                 num++;
                 locations1.add(item);
-                if(num % 1000 ==0 || num == locations.size()){
+                if (num % 1000 == 0 || num == locations.size()) {
                     locationMapper.addList(locations1);
-                    locations1=new ArrayList<>();
+                    locations1 = new ArrayList<>();
                 }
             }
-        }else {
+        } else {
             locationMapper.addList(locations);
         }
 
         List<Integer> integerList = new ArrayList<>();
-        for(Location location2 : locations) {
-            if(integerList.size() == 0) {
+        for (Location location2 : locations) {
+            if (integerList.size() == 0) {
                 integerList.add(location2.getIRow());
             } else {
-                for(int i = 0; i< integerList.size(); i++) {
-                    if(integerList.get(i).intValue() == location2.getIRow().intValue()) {
+                for (int i = 0; i < integerList.size(); i++) {
+                    if (integerList.get(i).intValue() == location2.getIRow().intValue()) {
                         break;
                     } else {
-                        if(i == (integerList.size() - 1)) {
+                        if (i == (integerList.size() - 1)) {
                             integerList.add(location2.getIRow());
                         }
                     }
                 }
             }
         }
-        if(integerList.size() == 4) {
+        if (integerList.size() == 4) {
             for (Location location3 : locations) {
                 for (int i = 0; i < integerList.size(); i++) {
                     if (location3.getIRow().intValue() == integerList.get(i).intValue()) {
@@ -201,32 +204,32 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
         typeLambda.eq(LocationType::getCode, locationType)
                 .select(LocationType::getCode);
         List<Map<String, Object>> list = locationTypeService.listMaps(typeLambda);
-        if (list.size() < 1){
+        if (list.size() < 1) {
             throw new ServiceException("库位类型编码不存在");
         }
 
         /* 判断库区编码是否存在*/
-        LambdaQueryWrapper<Zone> zoneLambda= Wrappers.lambdaQuery();
+        LambdaQueryWrapper<Zone> zoneLambda = Wrappers.lambdaQuery();
         zoneLambda.eq(Zone::getCode, zoneCode)
                 .select(Zone::getCode);
 
         list = zoneService.listMaps(zoneLambda);
-        if (list.size() < 1){
+        if (list.size() < 1) {
             throw new ServiceException("库区编码不存在");
         }
         //TODO:胡海--在判断库位类型和库区是否匹配,应该用库位类型表进行判断。库位类型在库区存在即可
        /* if(!zoneCode.equals(locationType)){
             throw new ServiceException(locationType+"的库位类型与"+ zoneCode +"库区不匹配");
         }*/
-      LambdaQueryWrapper<Zone> zoneLambdaQueryWrapper = Wrappers.lambdaQuery();
-      zoneLambdaQueryWrapper.eq(Zone::getCode, zoneCode);
-      Zone zone = zoneService.getOne(zoneLambdaQueryWrapper);
-      String area = zone.getArea();
-      List<Location> locations = new ArrayList<>(); // 为零?
-        for (int i=firstRow.intValue(); i<=lastRow.intValue(); i++)  {
-            for (int j=firstColumn.intValue(); j<=lastColumn.intValue(); j++)  {
-                for (int k=firstLayer.intValue(); k<=lastLayer.intValue(); k++)  {
-                    for (int m=firstGrid.intValue(); m<=lastGrid.intValue(); m++)  {
+        LambdaQueryWrapper<Zone> zoneLambdaQueryWrapper = Wrappers.lambdaQuery();
+        zoneLambdaQueryWrapper.eq(Zone::getCode, zoneCode);
+        Zone zone = zoneService.getOne(zoneLambdaQueryWrapper);
+        String area = zone.getArea();
+        List<Location> locations = new ArrayList<>(); // 为零?
+        for (int i = firstRow.intValue(); i <= lastRow.intValue(); i++) {
+            for (int j = firstColumn.intValue(); j <= lastColumn.intValue(); j++) {
+                for (int k = firstLayer.intValue(); k <= lastLayer.intValue(); k++) {
+                    for (int m = firstGrid.intValue(); m <= lastGrid.intValue(); m++) {
                         //Integer roadway = (j / 2) + 1;
                         Location param = new Location();
                         param.setIRow(i);
@@ -249,8 +252,8 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
                                 String.format("%02d", k));
                         //查询该库位编码是否存在
                         LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery();
-                        queryWrapper.eq(Location::getCode,code)
-                                .eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode());
+                        queryWrapper.eq(Location::getCode, code)
+                                .eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode());
                         List<Location> locationList = locationService.list(queryWrapper);
                         if (locationList.size() == 0) {
                             param.setCode(code);
@@ -261,38 +264,38 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
             }
         }
 
-        int num =0;
+        int num = 0;
         List<Location> locations1 = new ArrayList<>();
-        if(locations.size() >1000 ){
-            for(Location item : locations){
+        if (locations.size() > 1000) {
+            for (Location item : locations) {
                 num++;
                 locations1.add(item);
-                if(num % 1000 ==0 || num == locations.size()){
+                if (num % 1000 == 0 || num == locations.size()) {
                     locationMapper.addList(locations1);
-                    locations1=new ArrayList<>();
+                    locations1 = new ArrayList<>();
                 }
             }
-        }else {
+        } else {
             locationMapper.addList(locations);
         }
 
         List<Integer> integerList = new ArrayList<>();
-        for(Location location2 : locations) {
-            if(integerList.size() == 0) {
+        for (Location location2 : locations) {
+            if (integerList.size() == 0) {
                 integerList.add(location2.getIRow());
             } else {
-                for(int i = 0; i< integerList.size(); i++) {
-                    if(integerList.get(i).intValue() == location2.getIRow().intValue()) {
+                for (int i = 0; i < integerList.size(); i++) {
+                    if (integerList.get(i).intValue() == location2.getIRow().intValue()) {
                         break;
                     } else {
-                        if(i == (integerList.size() - 1)) {
+                        if (i == (integerList.size() - 1)) {
                             integerList.add(location2.getIRow());
                         }
                     }
                 }
             }
         }
-        if(integerList.size() == 4) {
+        if (integerList.size() == 4) {
             for (Location location3 : locations) {
                 for (int i = 0; i < integerList.size(); i++) {
                     if (location3.getIRow().intValue() == integerList.get(i).intValue()) {
@@ -312,6 +315,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
 
     /**
      * 根据库位编码对库位表格的状态进行更新
+     *
      * @param locationCode
      * @param status
      */
@@ -331,17 +335,18 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
 
     /**
      * 通过定位规则查找库位
+     *
      * @param locatingRule
      * @return
      */
     @Override
-    public String position(String locatingRule){
+    public String position(String locatingRule) {
         return locationMapper.position(locatingRule).getCode();
     }
 
     /**
      * 修改容器和库位状态
-     * */
+     */
     @Override
     public void updateContainerCodeAndStatus(String locationCode, String containerCode, String status) {
         if (StringUtils.isNotEmpty(locationCode) || StringUtils.isNotEmpty(containerCode)) {
@@ -392,17 +397,17 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
     public boolean checkLocation(String code) {
         LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(Location::getWarehouseCode, ShiroUtils.getWarehouseCode())
-                .eq(Location::getDeleted,false)
+                .eq(Location::getDeleted, false)
                 .eq(Location::getCode, code);
         List<Location> locations = list(queryWrapper);
-        if (locations.size() >= 1){
+        if (locations.size() >= 1) {
             Location location = locations.get(0);
-            String containerCode =location.getContainerCode();
+            String containerCode = location.getContainerCode();
             if (containerCode != null && containerCode.length() > 0) {
                 throw new ServiceException("货架上已有容器");
             }
             String status = location.getStatus();
-            if(!QuantityConstant.STATUS_LOCATION_EMPTY.equals(status)) {
+            if (!QuantityConstant.STATUS_LOCATION_EMPTY.equals(status)) {
                 throw new ServiceException("库位状态不为空");
             }
             return true;
@@ -419,7 +424,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
                 .eq(Location::getDeleted, false)
                 .eq(Location::getStatus, QuantityConstant.STATUS_LOCATION_EMPTY);
         List<Location> locations = locationService.list(lambdaQueryWrapper);
-        if(locations != null && locations.size() > 0) {
+        if (locations != null && locations.size() > 0) {
             return true;
         }
         return false;
@@ -427,6 +432,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
 
     /**
      * 查询库位利用率
+     *
      * @return
      */
     @Override
@@ -436,6 +442,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
 
     /**
      * 根据库位编码查询库位信息
+     *
      * @param code
      * @return
      */
@@ -475,11 +482,11 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
         queryWrapper.eq(Location::getLocationType, location.getLocationType());
         queryWrapper.eq(Location::getRowFlag, QuantityConstant.ROW_IN);
         List<Location> locationList = list(queryWrapper);
-        for(Location location1 : locationList) {
-           int diff = Math.abs(location1.getIRow().intValue() - location.getIRow().intValue());
-           if(diff == 1) {
-               return location1;
-           }
+        for (Location location1 : locationList) {
+            int diff = Math.abs(location1.getIRow().intValue() - location.getIRow().intValue());
+            if (diff == 1) {
+                return location1;
+            }
         }
         return null;
     }
@@ -495,9 +502,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
         queryWrapper.eq(Location::getLocationType, location.getLocationType());
         queryWrapper.eq(Location::getRowFlag, QuantityConstant.ROW_OUT);
         List<Location> locationList = list(queryWrapper);
-        for(Location location1 : locationList) {
+        for (Location location1 : locationList) {
             int diff = Math.abs(location1.getIRow().intValue() - location.getIRow().intValue());
-            if(diff == 1) {
+            if (diff == 1) {
                 return location1;
             }
         }
@@ -508,7 +515,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
     public Location getNear(Location location) {
         int rowFlag = location.getRowFlag().intValue();
         Location locaiton2 = null;
-        if(rowFlag == 1) {
+        if (rowFlag == 1) {
             locaiton2 = getInsideNear(location);
         } else {
             locaiton2 = getOutSideNear(location);
@@ -518,13 +525,13 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
 
     private boolean getOutSideCanMove(Location location) {
         Location locaiton2 = getInsideNear(location);
-        if(!locaiton2.getStatus().equals(QuantityConstant.STATUS_LOCATION_EMPTY)) {
-           return false;
+        if (!locaiton2.getStatus().equals(QuantityConstant.STATUS_LOCATION_EMPTY)) {
+            return false;
         }
-        if(!locaiton2.getContainerCode().equals("")) {
+        if (!locaiton2.getContainerCode().equals("")) {
             return false;
         }
-        return  true;
+        return true;
     }
 
     @Override
@@ -540,16 +547,18 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
         List<Location> locationList = list(queryWrapper);
         List<Location> removeLocationList = new ArrayList<>();
         int column = location.getIColumn();
-        Collections.sort(locationList, new Comparator<Location>(){
+        Collections.sort(locationList, new Comparator<Location>() {
             @Override
             public int compare(Location o1, Location o2) {
                 int dvalue1 = Math.abs(o1.getIColumn() - column);
                 int dvalue2 = Math.abs(o2.getIColumn() - column);
                 return dvalue1 - dvalue2;
             }
-            ;        });
+
+            ;
+        });
         int removeSize = 0;
-        for(int i=0; i < locationList.size(); i++) {
+        for (int i = 0; i < locationList.size(); i++) {
             Location location1 = locationList.get(i);
             if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) {
                 removeLocationList.add(location1);
@@ -563,7 +572,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
             }
         }
         locationList.removeAll(removeLocationList);
-        if(locationList == null || locationList.size() <= 0) {
+        if (locationList == null || locationList.size() <= 0) {
             return null;
         }
         Location location1 = locationList.get(0);
@@ -584,7 +593,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
         List<Location> locationList = list(queryWrapper);
         List<Location> removeLocaationList = new ArrayList<>();
         int column = location.getIColumn();
-        Collections.sort(locationList, new Comparator<Location>(){
+        Collections.sort(locationList, new Comparator<Location>() {
             @Override
             public int compare(Location o1, Location o2) {
                 int dvalue1 = Math.abs(o1.getIColumn() - column);
@@ -593,7 +602,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
             }
         });
         int removeSize = 0;
-        for(int i=0; i < locationList.size(); i++) {
+        for (int i = 0; i < locationList.size(); i++) {
             Location location1 = locationList.get(i);
             if (taskHeaderService.getUncompleteTaskInNear(location1) > 0) {
                 removeLocaationList.add(location1);
@@ -604,7 +613,7 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
             }
         }
         locationList.removeAll(removeLocaationList);
-        if(locationList == null || locationList.size() <= 0) {
+        if (locationList == null || locationList.size() <= 0) {
             return null;
         }
         Location location1 = locationList.get(0);
@@ -635,10 +644,21 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
         LambdaQueryWrapper<Location> wrapper = Wrappers.lambdaQuery();
         if ("status".equals(type)) {
             wrapper.eq(Location::getStatus, "lock");
-        }else if ("container".equals(type)){
+        } else if ("container".equals(type)) {
             wrapper.isNotNull(Location::getContainerCode)
-                    .ne(Location::getContainerCode,"");
+                    .ne(Location::getContainerCode, "");
         }
         return list(wrapper);
     }
+
+    @Override
+    public void upstatus(String code) {
+        Location user = new Location();
+        user.setStatus("empty");
+        //修改条件s
+        UpdateWrapper<Location> userUpdateWrapper = new UpdateWrapper<>();
+        userUpdateWrapper.eq("containerCode", code);
+        int update = locationMapper.update(user, userUpdateWrapper);
+        System.out.println(update);
+    }
 }
diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java
index f0bfb82..97631af 100644
--- a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java
+++ b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/controller/CycleCountDetailController.java
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.huaheng.common.constant.QuantityConstant;
 import com.huaheng.common.support.Convert;
 import com.huaheng.common.utils.StringUtils;
 import com.huaheng.common.utils.security.ShiroUtils;
@@ -20,7 +19,6 @@ import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail;
 import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetailChild;
 import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailChildService;
 import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService;
-import com.huaheng.pc.inventory.inventoryHeader.domain.InventoryHeader;
 import com.huaheng.pc.task.taskHeader.service.CycleCountTaskService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.stereotype.Controller;
@@ -43,6 +41,7 @@ import java.util.List;
 @RequestMapping("/inventory/cycleCountDetail")
 public class CycleCountDetailController extends BaseController {
 
+
     @Resource
     private LocationService locationService;
     @Resource
@@ -197,18 +196,16 @@ public class CycleCountDetailController extends BaseController {
             return AjaxResult.error("删除的明细id不能为空");
         }
         Integer[] detailsIds = Convert.toIntArray(ids);
+
         for(int i = 0; i < detailsIds.length; i++){
             Integer id = detailsIds[i];
+            String code = cycleCountDetailService.getById(detailsIds[i]).getContainerCode();
             AjaxResult ajaxResult = cycleCountDetailService.removeDetail(id);
+            locationService.upstatus(code);
             if(ajaxResult.getCode() != 200){
                 return ajaxResult;
             }
-            CycleCountDetail aa = cycleCountDetailService.getcode(id);
-
-            locationService.updateStatus(aa.getLocationCode(), QuantityConstant.STATUS_LOCATION_EMPTY);
-
         }
-
         return AjaxResult.success("删除成功!");
     }
 
diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/controller/CycleCountHeaderController.java b/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/controller/CycleCountHeaderController.java
index 030dcae..4634740 100644
--- a/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/controller/CycleCountHeaderController.java
+++ b/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/controller/CycleCountHeaderController.java
@@ -14,6 +14,7 @@ import com.huaheng.framework.web.domain.AjaxResult;
 import com.huaheng.framework.web.page.PageDomain;
 import com.huaheng.framework.web.page.TableDataInfo;
 import com.huaheng.framework.web.page.TableSupport;
+import com.huaheng.pc.inventory.cycleCountDetail.controller.CycleCountDetailController;
 import com.huaheng.pc.inventory.cycleCountDetail.domain.CycleCountDetail;
 import com.huaheng.pc.inventory.cycleCountDetail.service.CycleCountDetailService;
 import com.huaheng.pc.inventory.cycleCountHeader.domain.CycleCountHeader;
@@ -41,7 +42,6 @@ public class CycleCountHeaderController extends BaseController {
     private CycleCountDetailService cycleCountDetailService;
 
 
-
     private String prefix = "inventory/cycleCountHeader";
 
 
@@ -159,11 +159,21 @@ public class CycleCountHeaderController extends BaseController {
         }
         for (Integer id : Convert.toIntArray(ids))
         {
+            String code = cycleCountHeaderService.getById(id).getCode();
+            LambdaQueryWrapper<CycleCountDetail> lambdaQueryWrapper = Wrappers.lambdaQuery();
+            lambdaQueryWrapper.eq(CycleCountDetail::getCycleCountHeadCode,code);
+            List<CycleCountDetail> list = cycleCountDetailService.list(lambdaQueryWrapper);
+            if (list.size()>0)
+            {
+                return AjaxResult.error("盘点下有明细,删除失败!");
+            }
+
             AjaxResult result = cycleCountHeaderService.delete(id);
 
             if(result.code!=200){
                 return result;
             }
+
         }
         return AjaxResult.success("删除成功!");
     }