diff --git a/src/main/java/com/huaheng/pc/config/company/controller/CompanyController.java b/src/main/java/com/huaheng/pc/config/company/controller/CompanyController.java
index 402a445..36c06fc 100644
--- a/src/main/java/com/huaheng/pc/config/company/controller/CompanyController.java
+++ b/src/main/java/com/huaheng/pc/config/company/controller/CompanyController.java
@@ -60,7 +60,8 @@ public class CompanyController extends BaseController {
         lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), Company::getCreated, createdBegin)
                 .lt(StringUtils.isNotEmpty(createdEnd), Company::getCreated, createdEnd)
                 .eq(StringUtils.isNotEmpty(company.getCode()), Company::getCode, company.getCode())
-                .eq(StringUtils.isNotEmpty(company.getName()), Company::getName, company.getName())
+                .like(StringUtils.isNotEmpty(company.getName()), Company::getName, company.getName())
+                .eq(Company::getDeleted,false)
                 .orderByDesc(Company::getCreated);
 
         if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
diff --git a/src/main/java/com/huaheng/pc/config/company/service/CompanyServiceImpl.java b/src/main/java/com/huaheng/pc/config/company/service/CompanyServiceImpl.java
index 0a726aa..0beb960 100644
--- a/src/main/java/com/huaheng/pc/config/company/service/CompanyServiceImpl.java
+++ b/src/main/java/com/huaheng/pc/config/company/service/CompanyServiceImpl.java
@@ -91,7 +91,6 @@ public class CompanyServiceImpl extends ServiceImpl<CompanyMapper, Company> impl
         {
             record.setCompanyId(company.getId());
             record.setCompanyCode(company.getCode());
-            record.setWarehouseId(Integer.valueOf(warehouse[i]));
             record.setWarehouseCode(warehouse[i+1]);
             warehouseCompanyService.save(record);
         }
diff --git a/src/main/java/com/huaheng/pc/config/container/controller/ContainerController.java b/src/main/java/com/huaheng/pc/config/container/controller/ContainerController.java
index 4ffe767..24f5182 100644
--- a/src/main/java/com/huaheng/pc/config/container/controller/ContainerController.java
+++ b/src/main/java/com/huaheng/pc/config/container/controller/ContainerController.java
@@ -71,7 +71,8 @@ public class ContainerController extends BaseController {
                 .eq(StringUtils.isNotEmpty(container.getWarehouseCode()), Container::getWarehouseCode, container.getWarehouseCode())
                 .eq(StringUtils.isNotEmpty(container.getLocationCode()), Container::getLocationCode, container.getLocationCode())
                 .eq(Container::getWarehouseCode, ShiroUtils.getWarehouseCode())
-                .orderByDesc(Container::getCreated);
+                .eq(Container::getEnable,true)
+                .orderByDesc(Container::getId);
 
         if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
             /*使用分页查询*/
@@ -147,7 +148,7 @@ public class ContainerController extends BaseController {
         for (Integer id : Convert.toIntArray(ids)) {
             Container container = containerService.getById(id);
             if (container.getStatus().equals("empty") && StringUtils.isEmpty(container.getLocationCode())) {
-                container.setDeleted(true);
+                container.setEnable(false);
                 container.setLastUpdatedBy(ShiroUtils.getLoginName());
                 containerService.updateById(container);
             } else {
diff --git a/src/main/java/com/huaheng/pc/config/container/domain/Container.java b/src/main/java/com/huaheng/pc/config/container/domain/Container.java
index 225018f..210358f 100644
--- a/src/main/java/com/huaheng/pc/config/container/domain/Container.java
+++ b/src/main/java/com/huaheng/pc/config/container/domain/Container.java
@@ -106,7 +106,7 @@ public class Container implements Serializable {
     @TableField(value = "enable")
     @ApiModelProperty(value="启用;0—禁用")
     @Excel(name = "是否启用", prompt = "启用;0 禁用:1")
-    private Integer enable;
+    private Boolean enable;
 
     /**
      * 打印次数
@@ -185,10 +185,7 @@ public class Container implements Serializable {
     @ApiModelProperty(value="处理标记")
     private String processStamp;
 
-    @TableField(value = "deleted")
-    @ApiModelProperty(value = "是否删除")
-    @TableLogic
-    private Boolean deleted;
+
 
     private static final long serialVersionUID = 1L;
 
diff --git a/src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java b/src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java
index 04a1f07..09c1ec2 100644
--- a/src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java
+++ b/src/main/java/com/huaheng/pc/config/container/service/ContainerServiceImpl.java
@@ -41,8 +41,7 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container
             container.setCreatedBy(ShiroUtils.getLoginName());
             container.setLastUpdated(null);
             container.setLastUpdatedBy(null);
-            container.setEnable(0);
-            container.setDeleted(false);
+            container.setEnable(true);
             container.setCompanyCode(ShiroUtils.getCompanyCodeList().get(0));
             container.setWarehouseCode(ShiroUtils.getWarehouseCode());
             this.save(container);
@@ -60,7 +59,7 @@ public class ContainerServiceImpl extends ServiceImpl<ContainerMapper, Container
         Container container = containerMapper.selectOne(lambda);
 
         //如果指定类型的最后的code存在,那么 code = 容器类型 + (排序号 + 1)
-        if (container.getCode() != null) {
+        if (container!=null && container.getCode() != null) {
             Integer number = Integer.valueOf(container.getCode().substring(container.getCode().length() - 5, container.getCode().length()));
             return  number;
         } else {
diff --git a/src/main/java/com/huaheng/pc/config/location/controller/LocationController.java b/src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
index cfdb477..e26903c 100644
--- a/src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
+++ b/src/main/java/com/huaheng/pc/config/location/controller/LocationController.java
@@ -72,9 +72,10 @@ public class LocationController extends BaseController {
                 .eq(StringUtils.isNotNull(location.getIColumn()), Location::getIColumn, location.getIColumn())
                 .eq(StringUtils.isNotNull(location.getIGrid()), Location::getIGrid, location.getIGrid())
                 .eq(StringUtils.isNotNull(location.getILayer()), Location::getILayer, location.getILayer())
+                .eq(StringUtils.isNotEmpty(location.getStatus()),Location::getStatus,location.getStatus())
                 .eq(StringUtils.isNotEmpty(location.getLocationType()), Location::getLocationType, location.getLocationType())
                 .eq(Location::getDeleted,false)
-                .orderByDesc(Location::getCreated);
+                .orderByDesc(Location::getId);
 
         if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
             /*使用分页查询*/
@@ -104,8 +105,8 @@ public class LocationController extends BaseController {
     @PostMapping("/add")
     @ResponseBody
     public AjaxResult addSave(Location location)  {
-        Boolean result = locationService.save(location);
-        return toAjax(result);
+        AjaxResult result = locationService.addsave(location);
+        return result;
     }
 
 
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 9dc7299..6500a7f 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
@@ -1,9 +1,12 @@
 package com.huaheng.pc.config.location.service;
 
+import com.huaheng.framework.web.domain.AjaxResult;
 import com.huaheng.pc.config.location.domain.Location;
 import com.baomidou.mybatisplus.extension.service.IService;
 public interface LocationService extends IService<Location>{
 
+    AjaxResult addsave(Location location);
+
     boolean insertLocation(Location location);
 
     void updateStatus(String locationCode, String status);
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 fbe766a..d616478 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
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.huaheng.common.exception.service.ServiceException;
 import com.huaheng.common.utils.StringUtils;
 import com.huaheng.common.utils.security.ShiroUtils;
+import com.huaheng.framework.web.domain.AjaxResult;
 import com.huaheng.pc.config.locationType.domain.LocationType;
 import com.huaheng.pc.config.locationType.service.LocationTypeService;
 import com.huaheng.pc.config.zone.domain.Zone;
@@ -33,6 +34,45 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
     @Resource
     private LocationMapper locationMapper;
 
+
+    //新增库位,需要建立code,并判断是否重复
+    @Override
+    public AjaxResult addsave(Location location){
+
+        //库区与库位类型的匹配判断
+        if(!location.getZoneCode().equals(location.getLocationType())){
+            throw new ServiceException(location.getLocationType()+"的库位类型与"+location.getZoneCode()+"库区不匹配");
+        }
+
+        //创建库位编码code
+        String prefix = location.getLocationType().substring(1);
+        String code = MessageFormat.format("{0}{1}-{2}-{3}-{4}",
+                prefix,
+                String.format("%02d", location.getIRow()),
+                String.format("%02d", location.getIColumn()),
+                String.format("%02d", location.getILayer()),
+                String.format("%02d", location.getIGrid()));
+
+
+        //判断code是否重复
+        LambdaQueryWrapper<Location> lam = Wrappers.lambdaQuery();
+        lam.eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode())
+                .eq(Location::getCode,code);
+        if(this.getOne(lam)!=null){
+            return AjaxResult.error("该位置已有库位生成,请重新输入位置");
+        }
+
+        //插入数据库
+        location.setCode(code);
+        location.setWarehouseCode(ShiroUtils.getWarehouseCode());
+        location.setCreatedBy(ShiroUtils.getLoginName());
+        Boolean flag=this.save(location);
+        if(flag == false){
+            return AjaxResult.error("新增库位失败,插入数据库时失败");
+        }
+        return AjaxResult.success("新增库位成功");
+    }
+
     @Override
     public boolean insertLocation(Location location) {
         /* 判断库位类型编码是否存在*/
@@ -54,6 +94,9 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
             throw new ServiceException("库区编码不存在");
         }
 
+        if(!location.getZoneCode().equals(location.getLocationType())){
+            throw new ServiceException(location.getLocationType()+"的库位类型与"+location.getZoneCode()+"库区不匹配");
+        }
         String prefix = location.getLocationType().substring(1);
         List<Location> locations = new ArrayList<>();
         for (int i=1; i<=location.getIRow().intValue(); i++)  {
@@ -78,18 +121,14 @@ public class LocationServiceImpl extends ServiceImpl<LocationMapper, Location> i
                                 String.format("%02d", j),
                                 String.format("%02d", k),
                                 String.format("%02d", m));
-                        QueryWrapper<Location> queryWrapper = new QueryWrapper<>();
-                        List<Location> locationList = locationService.list(queryWrapper.eq("code", code));
-                        if (locationList.size() != 0){
-                            return true;
-                        } else {
+                        LambdaQueryWrapper<Location> queryWrapper = Wrappers.lambdaQuery();
+                        queryWrapper.eq(Location::getCode,code)
+                                .eq(Location::getWarehouseCode,ShiroUtils.getWarehouseCode());
+                        List<Location> locationList = locationService.list(queryWrapper);
+                        if (locationList.size() == 0) {
                             param.setCode(code);
-                            location.setWarehouseCode(ShiroUtils.getWarehouseCode());
-                            location.setCreatedBy(ShiroUtils.getLoginName());
-                            location.setLastUpdatedBy(ShiroUtils.getLoginName());
+                            locations.add(param);
                         }
-                        param.setCode(code);
-                        locations.add(param);
                     }
                 }
             }
diff --git a/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java b/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java
index 6f5f921..dcd856b 100644
--- a/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java
+++ b/src/main/java/com/huaheng/pc/config/locationType/service/LocationTypeServiceImpl.java
@@ -17,7 +17,6 @@ public class LocationTypeServiceImpl extends ServiceImpl<LocationTypeMapper, Loc
     public List<Map<String, Object>> getLocationPrefix(){
         LambdaQueryWrapper<LocationType> lambdaQueryWrapper = Wrappers.lambdaQuery();
         lambdaQueryWrapper.eq(LocationType::getWarehouseCode, ShiroUtils.getWarehouseCode())
-                .eq(LocationType::getEnable, false)
                 .eq(LocationType::getEnable, true);
         return this.listMaps(lambdaQueryWrapper);
     }
diff --git a/src/main/java/com/huaheng/pc/config/material/service/MaterialServiceImpl.java b/src/main/java/com/huaheng/pc/config/material/service/MaterialServiceImpl.java
index faf608a..7befdf9 100644
--- a/src/main/java/com/huaheng/pc/config/material/service/MaterialServiceImpl.java
+++ b/src/main/java/com/huaheng/pc/config/material/service/MaterialServiceImpl.java
@@ -144,7 +144,11 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
         material.setWarehouseCode(ShiroUtils.getWarehouseCode());
         material.setCreatedBy(ShiroUtils.getLoginName());
         material.setLastUpdatedBy(ShiroUtils.getLoginName());
-        return null;
+        Boolean flag=this.save(material);
+        if(flag==false){
+            return AjaxResult.error("新增物料失败,存入数据库时报错");
+        }
+        return AjaxResult.success("新增物料成功");
     }
 
     /**
diff --git a/src/main/java/com/huaheng/pc/config/materialUnit/controller/MaterialUnitController.java b/src/main/java/com/huaheng/pc/config/materialUnit/controller/MaterialUnitController.java
index b582649..111fa2d 100644
--- a/src/main/java/com/huaheng/pc/config/materialUnit/controller/MaterialUnitController.java
+++ b/src/main/java/com/huaheng/pc/config/materialUnit/controller/MaterialUnitController.java
@@ -66,10 +66,11 @@ public class MaterialUnitController extends BaseController {
         lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), MaterialUnit::getCreated, createdBegin)
                 .lt(StringUtils.isNotEmpty(createdEnd), MaterialUnit::getCreated, createdEnd)
                 .eq(StringUtils.isNotEmpty(materialUnit.getMaterialCode()), MaterialUnit::getMaterialCode, materialUnit.getMaterialCode())
-                .eq(StringUtils.isNotEmpty(materialUnit.getMaterialName()), MaterialUnit::getMaterialName, materialUnit.getMaterialName())
+                .like(StringUtils.isNotEmpty(materialUnit.getMaterialName()), MaterialUnit::getMaterialName, materialUnit.getMaterialName())
                 .eq(StringUtils.isNotEmpty(materialUnit.getUnit()), MaterialUnit::getUnit, materialUnit.getUnit())
                 .in(MaterialUnit::getCompanyCode, ShiroUtils.getCompanyCodeList())
-                .eq(MaterialUnit::getWarehouseCode, ShiroUtils.getWarehouseCode());
+                .eq(MaterialUnit::getWarehouseCode, ShiroUtils.getWarehouseCode())
+                .orderByDesc(MaterialUnit::getId);
 
         if (StringUtils.isNotNull(pageNum) && StringUtils.isNotNull(pageSize)){
             /*使用分页查询*/
diff --git a/src/main/java/com/huaheng/pc/config/warehouse/controller/WareHouseController.java b/src/main/java/com/huaheng/pc/config/warehouse/controller/WareHouseController.java
index 28287c0..a206a49 100644
--- a/src/main/java/com/huaheng/pc/config/warehouse/controller/WareHouseController.java
+++ b/src/main/java/com/huaheng/pc/config/warehouse/controller/WareHouseController.java
@@ -67,9 +67,9 @@ public class WareHouseController extends BaseController {
         lambdaQueryWrapper.gt(StringUtils.isNotEmpty(createdBegin), Warehouse::getCreated, createdBegin)
                 .lt(StringUtils.isNotEmpty(createdEnd), Warehouse::getCreated, createdEnd)
                 .eq(StringUtils.isNotEmpty(warehouse.getCode()), Warehouse::getCode, warehouse.getCode())
-                .eq(StringUtils.isNotEmpty(warehouse.getName()), Warehouse::getName,warehouse.getName())
-                .orderByDesc(Warehouse::getCreated)
-                .eq(Warehouse::getDeleted,0);
+                .like(StringUtils.isNotEmpty(warehouse.getName()), Warehouse::getName,warehouse.getName())
+                .eq(Warehouse::getDeleted,false)
+                .orderByDesc(Warehouse::getCreated);
         /**
          * 使用分页查询
          */
@@ -149,9 +149,10 @@ public class WareHouseController extends BaseController {
             if (count != 0) {
                 return AjaxResult.error("仓库编码(" + warehouse.getCode() +")还有库存,不能删除!");
             }
+            warehouse.setCode(code);
             warehouse.setLastUpdatedBy(ShiroUtils.getLoginName());
             warehouse.setDeleted(true);
-            warehouseService.updateById(warehouse);
+            warehouseService.saveOrUpdate(warehouse);
             dictDataService.deleteDictDataByWarehouseCode(code);
             dictTypeService.deleteDictTypeByWarehouseCode(code);
         }
diff --git a/src/main/java/com/huaheng/pc/config/warehouseCompany/domain/WarehouseCompany.java b/src/main/java/com/huaheng/pc/config/warehouseCompany/domain/WarehouseCompany.java
index cb7fadb..32c0c33 100644
--- a/src/main/java/com/huaheng/pc/config/warehouseCompany/domain/WarehouseCompany.java
+++ b/src/main/java/com/huaheng/pc/config/warehouseCompany/domain/WarehouseCompany.java
@@ -17,11 +17,6 @@ public class WarehouseCompany implements Serializable {
      @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
-    /**
-     * 仓库id
-     */
-    @TableField(value = "warehouseId")
-    private Integer warehouseId;
 
     /**
      * 仓库编码
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 a0f4bbf..45f170a 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
@@ -77,7 +77,7 @@ public class CycleCountDetailController extends BaseController {
         PageDomain pageDomain = TableSupport.buildPageRequest();
         Integer pageNum = pageDomain.getPageNum();
         Integer pageSize = pageDomain.getPageSize();
-        //没有主单ID传入则直接返回空list
+        //没有主单Code传入则直接返回空list
         if(cycleCountDetail.getCycleCountHeadCode() != null){
         lambdaQueryWrapper.ge(
                 StringUtils.isNotEmpty(createdBegin), CycleCountDetail::getCreated, createdBegin)
@@ -121,17 +121,20 @@ public class CycleCountDetailController extends BaseController {
      * 新增盘点明细
      */
     @GetMapping("/add")
-    public String add(Integer cycleCountHeadId,String companyCode, ModelMap m)
+    public String add(String cycleCountHeadCode,String companyCode, ModelMap m)
     {
-        if(cycleCountHeadId == null){
+        if(cycleCountHeadCode == null){
             throw new SecurityException("盘点头ID不能为空!");
         }
         //相同货主才能盘点,取出盘点头的货主
-        CycleCountHeader cycleCountHeader = cycleCountHeaderService.getById(cycleCountHeadId);
+        CycleCountHeader cycleCountHeader = new CycleCountHeader();
+        cycleCountHeader.setCode(cycleCountHeadCode);
+        cycleCountHeader.setWarehouseCode(ShiroUtils.getWarehouseCode());
+        LambdaQueryWrapper<CycleCountHeader> lamd = Wrappers.lambdaQuery(cycleCountHeader);
+        cycleCountHeader = cycleCountHeaderService.getOne(lamd);
         companyCode = cycleCountHeader.getCompanyCode();
         m.put("companyCode",companyCode);
-        m.put("cycleCountHeadId",cycleCountHeadId);
-
+        m.put("cycleCountHeadCode",cycleCountHeadCode);
         return prefix + "/add";
     }
 
@@ -160,15 +163,16 @@ public class CycleCountDetailController extends BaseController {
             return AjaxResult.error("删除的明细id不能为空");
         Integer[] detailsIds = Convert.toIntArray(ids);
         CycleCountDetail cyclecountDetail = cycleCountDetailService.getById(detailsIds[0]);
-        String masterCode = cyclecountDetail.getCycleCountHeadCode();
         CycleCountHeader ch = new CycleCountHeader();
-        ch.setMasterCode(masterCode);
+        ch.setCode(cyclecountDetail.getCycleCountHeadCode());
+        ch.setWarehouseCode(cyclecountDetail.getWarehouseCode());
+        ch.setCompanyCode(cyclecountDetail.getCompanyCode());
         LambdaQueryWrapper<CycleCountHeader> la = Wrappers.lambdaQuery(ch);
         CycleCountHeader cyclecountHeader = cycleCountHeaderService.getOne(la);
-        if(cyclecountHeader==null){
+        if(cyclecountHeader == null){
             return AjaxResult.error("主单据不存在");
         }
-        if(cyclecountHeader.getStatusCyc() > 29){
+        if(cyclecountHeader.getStatusCyc() > 5){
             return AjaxResult.error("主单据状态不允许删除");
         }
         for (Integer id : detailsIds)
diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java
index 7803f5f..5903736 100644
--- a/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java
+++ b/src/main/java/com/huaheng/pc/inventory/cycleCountDetail/service/CycleCountDetailServiceImpl.java
@@ -53,8 +53,11 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap
     @Transactional
     public AjaxResult addDetails(String cycleCountHeadCode, Integer[] inventoryDetailIdIds) {
 
+        if(cycleCountHeadCode == null){
+            throw new ServiceException("盘点主单编码不能为空!");
+        }
         CycleCountHeader cyclecountHeader =new CycleCountHeader();
-        cyclecountHeader.setMasterCode(cycleCountHeadCode);
+        cyclecountHeader.setCode(cycleCountHeadCode);
         LambdaQueryWrapper<CycleCountHeader> ch = Wrappers.lambdaQuery(cyclecountHeader);
         cyclecountHeader = cycleCountHeaderService.getOne(ch);
         //可能存在并发删除的情况
@@ -68,7 +71,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap
         CycleCountDetail cycleCountDetail = new CycleCountDetail();
         cycleCountDetail.setWarehouseCode(cyclecountHeader.getWarehouseCode());
         cycleCountDetail.setCompanyCode(cyclecountHeader.getCompanyCode());
-        cycleCountDetail.setCycleCountHeadCode(cyclecountHeader.getMasterCode());
+        cycleCountDetail.setCycleCountHeadCode(cyclecountHeader.getCode());
         LambdaQueryWrapper<CycleCountDetail> cycleCountDetailLambd = Wrappers.lambdaQuery(cycleCountDetail);
         List<CycleCountDetail> cyclecountDetailList = this.list(cycleCountDetailLambd);
         if(cyclecountDetailList == null){
@@ -84,7 +87,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap
 
             //写入盘点明细
             CycleCountDetail ccd = new CycleCountDetail();
-            ccd.setCycleCountHeadCode(cyclecountHeader.getMasterCode());
+            ccd.setCycleCountHeadCode(cyclecountHeader.getCode());
             ccd.setInventoryDetailId(inventoryDetailId);
             ccd.setWarehouseCode(inventoryDetail.getWarehouseCode());
             ccd.setCompanyCode(inventoryDetail.getCompanyCode());
@@ -125,14 +128,14 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap
     @Transactional
     public AjaxResult createCycleCountTaskByHeadId(String cycleCountHeadCode) {
         CycleCountHeader cyclecountHeader =new CycleCountHeader();
-        cyclecountHeader.setMasterCode(cycleCountHeadCode);
+        cyclecountHeader.setCode(cycleCountHeadCode);
         LambdaQueryWrapper<CycleCountHeader> cych = Wrappers.lambdaQuery(cyclecountHeader);
-        cyclecountHeader = cycleCountHeaderService.getById(cych);
+        cyclecountHeader = cycleCountHeaderService.getOne(cych);
         if(cyclecountHeader == null){
             return AjaxResult.error("盘点单不存在");
         }
         CycleCountDetail temp = new CycleCountDetail();
-        temp.setCycleCountHeadCode(cyclecountHeader.getMasterCode());
+        temp.setCycleCountHeadCode(cyclecountHeader.getCode());
         temp.setWarehouseCode(cyclecountHeader.getWarehouseCode());
         temp.setCompanyCode(cyclecountHeader.getCompanyCode());
         LambdaQueryWrapper<CycleCountDetail> lambdaQueryWrapper = Wrappers.lambdaQuery(temp);
@@ -172,8 +175,9 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap
     @Override
     @Transactional
     public AjaxResult createCycleCoutTaskByDetailId(Integer cycleCoutdetailId) {
-        /*任务主表中存在库位,在盘点明细中生成任务时,不同的库位需要生成不同的主任务*/
-
+        /*任务主表中存在库位,在盘点明细中生成任务时,不同的容器生成不同的主任务*/
+        //在盘点单生成任务并执行后,同一容器的物料仍然可以生成任务,否则任务已完成则无法添加任务100
+        //检查状态不为100的任务,在有和下发的盘点单容器相同的任务时,把该条明细的任务写入到当前相同容器的任务里
 
         CycleCountDetail cycleCountDetail = this.getById(cycleCoutdetailId);
         if(cycleCountDetail == null ){
@@ -190,29 +194,67 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap
         if(StringUtils.isEmpty(loc.getContainerCode())){
             return AjaxResult.error(cycleCountDetail.getLocationCode()+"没有托盘,操作失败");
         }
+
+        //查询任务头和明细有相同容器,没有就新增任务头和明细
+
+        LambdaQueryWrapper<TaskHeader> taskHeaderLambdaQueryWrapper = Wrappers.lambdaQuery();
+        taskHeaderLambdaQueryWrapper
+                .lt(TaskHeader::getStatus,100)
+                .eq(TaskHeader::getWarehouseCode,ShiroUtils.getWarehouseCode())
+                .eq(TaskHeader::getCompanyCode,cycleCountDetail.getCompanyCode())
+                .eq(TaskHeader::getInternalTaskType,700)
+                .eq(TaskHeader::getTaskType,700)
+                .eq(TaskHeader::getContainerCode,cycleCountDetail.getContainerCode());//容器
+        List<TaskHeader> taskHeaderList = taskHeaderService.list(taskHeaderLambdaQueryWrapper);
+
+
         TaskHeader task = new TaskHeader();
-        task.setWarehouseCode(ShiroUtils.getWarehouseCode());
-        task.setCompanyCode(cycleCountDetail.getCompanyCode());
-        task.setInternalTaskType(700);
-        task.setTaskType(700);
-        task.setContainerCode(cycleCountDetail.getContainerCode());
-        task.setStatus(0);
-        task.setFromLocation(cycleCountDetail.getLocationCode());
-        task.setToLocation(cycleCountDetail.getLocationCode());
-        task.setCreated(new Date());
-        task.setCreatedBy(ShiroUtils.getLoginName());
-        task.setLastUpdatedBy(ShiroUtils.getLoginName());
-        task.setLastUpdated(new Date());
-        if(taskHeaderService.save(task)){
-            //锁定库位状态
-            locationService.updateStatus(loc.getContainerCode(),"lock");
+        TaskDetail taskDetail = new TaskDetail();
+
+        if(taskHeaderList.size() <= 0){
+
+            //存在相同容器的主任务直接加入该条主任务的明细
+            task.setWarehouseCode(ShiroUtils.getWarehouseCode());
+            task.setCompanyCode(cycleCountDetail.getCompanyCode());
+            task.setInternalTaskType(700);
+            task.setTaskType(700);
+            task.setContainerCode(cycleCountDetail.getContainerCode());
+            task.setStatus(0);
+            task.setFromLocation(cycleCountDetail.getLocationCode());
+            task.setToLocation(cycleCountDetail.getLocationCode());
+            task.setCreated(new Date());
+            task.setCreatedBy(ShiroUtils.getLoginName());
+            task.setLastUpdatedBy(ShiroUtils.getLoginName());
+            task.setLastUpdated(new Date());
+            if(taskHeaderService.save(task)){
+                //锁定库位状态
+                locationService.updateStatus(loc.getContainerCode(),"lock");
+            }else{
+                throw new ServiceException("盘点任务主表生成失败!");
+            }
+            //写入任务细表
+            taskDetail.setTaskId(task.getId());//主单ID
+            taskDetail.setTaskType(task.getTaskType());
+            taskDetail.setFromLocation(task.getFromLocation());
+            taskDetail.setToLocation(task.getToLocation());
+            taskDetail.setContainerCode(task.getContainerCode());
+            taskDetail.setInternalTaskType(task.getTaskType());
+            taskDetail.setWarehouseCode(task.getWarehouseCode());
+            cycleCountDetail.setTaskHeaderId(task.getId()); //盘点明细修改状态task数据源
         }else{
-            throw new ServiceException("盘点任务主表生成失败!");
+
+            //取其中一条主单即可
+            TaskHeader taskHeader = taskHeaderList.get(0);
+            taskDetail.setTaskId(taskHeader.getId());//主单ID
+            taskDetail.setTaskType(taskHeader.getTaskType());
+            taskDetail.setFromLocation(taskHeader.getFromLocation());
+            taskDetail.setToLocation(taskHeader.getToLocation());
+            taskDetail.setContainerCode(taskHeader.getContainerCode());
+            taskDetail.setInternalTaskType(taskHeader.getTaskType());
+            taskDetail.setWarehouseCode(taskHeader.getWarehouseCode());
+            cycleCountDetail.setTaskHeaderId(taskHeader.getId());//盘点明细修改状态taskHeader数据源
         }
-        //写入任务细表
-        TaskDetail taskDetail = new TaskDetail();
-        taskDetail.setTaskId(task.getId());//主单ID
-        taskDetail.setTaskType(task.getTaskType());
+
         taskDetail.setBillCode(cycleCountDetail.getCycleCountHeadCode());
         taskDetail.setBillDetailId(cycleCountDetail.getId());
         taskDetail.setMaterialCode(cycleCountDetail.getMaterialCode());
@@ -223,34 +265,31 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap
         taskDetail.setFromInventoryId(cycleCountDetail.getInventoryDetailId());
         taskDetail.setLot(cycleCountDetail.getLot());
         taskDetail.setProjectNo(cycleCountDetail.getProjectNo());
-        taskDetail.setInternalTaskType(task.getTaskType());
-        taskDetail.setWarehouseCode(task.getWarehouseCode());
         taskDetail.setCompanyCode(cycleCountDetail.getCompanyCode());
-        taskDetail.setFromLocation(task.getFromLocation());
-        taskDetail.setToLocation(task.getToLocation());
-        taskDetail.setContainerCode(task.getContainerCode());
         taskDetail.setCreated(new Date());
         taskDetail.setCreatedBy(ShiroUtils.getLoginName());
         taskDetail.setLastUpdated(new Date());
         taskDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
         if(taskDetailService.save(taskDetail) == false){
             throw new ServiceException("盘点任务明细生成失败!");
-        }
+            }
+
         //修改细单状态
         cycleCountDetail.setTaskHeaderId(taskDetail.getId());
-        cycleCountDetail.setTaskHeaderId(task.getId());
+        //cycleCountDetail.setTaskHeaderId(task.getId());
         cycleCountDetail.setLastUpdated(new Date());
         cycleCountDetail.setLastUpdatedBy(ShiroUtils.getLoginName());
         cycleCountDetail.setEnableStatus(5);
         this.saveOrUpdate(cycleCountDetail);
+
         //修改主单状态
         CycleCountHeader cycleCountHeader = new CycleCountHeader();
-        cycleCountHeader.setMasterCode(cycleCountDetail.getCycleCountHeadCode());
+        cycleCountHeader.setCode(cycleCountDetail.getCycleCountHeadCode());
         cycleCountHeader.setWarehouseCode(cycleCountDetail.getWarehouseCode());
         cycleCountHeader.setCompanyCode(cycleCountDetail.getCompanyCode());
         LambdaQueryWrapper<CycleCountHeader> lamb = Wrappers.lambdaQuery(cycleCountHeader);
         cycleCountHeader = cycleCountHeaderService.getOne(lamb);
-        cycleCountHeader.setStatusCyc(10);
+        cycleCountHeader.setStatusCyc(5);
         cycleCountHeaderService.saveOrUpdate(cycleCountHeader);
         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 b98ad1a..31e041d 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
@@ -78,7 +78,7 @@ public class CycleCountHeaderController extends BaseController {
                 .eq(CycleCountHeader::getWarehouseCode, ShiroUtils.getWarehouseCode()) //仓库
                 .eq(StringUtils.isNotEmpty(cycleCountHeader.getSourceCode()),CycleCountHeader::getSourceCode,cycleCountHeader.getSourceCode())//源盘点单号
                 .eq(cycleCountHeader.getId() != null, CycleCountHeader::getId,cycleCountHeader.getId())//ID
-                .eq(StringUtils.isNotEmpty(cycleCountHeader.getMasterCode()),CycleCountHeader::getMasterCode, cycleCountHeader.getMasterCode())//盘点主表编号
+                .eq(StringUtils.isNotEmpty(cycleCountHeader.getCode()),CycleCountHeader::getCode, cycleCountHeader.getCode())//盘点主表编号
                 .eq(cycleCountHeader.getCountOrderId() != null, CycleCountHeader::getCountOrderId, cycleCountHeader.getCountOrderId())//原始盘点ID
                 .eq(cycleCountHeader.getStatusCyc() != null, CycleCountHeader::getStatusCyc, cycleCountHeader.getStatusCyc()) //盘点单状态
                 .eq(cycleCountHeader.getCountType() != null ,CycleCountHeader::getCountType, cycleCountHeader.getCountType())//盘点类型
@@ -119,7 +119,7 @@ public class CycleCountHeaderController extends BaseController {
         //cycleCountHeader.setRound(cycleCountHeader.getRound());//盘点轮次
         cycleCountHeader.setCreated(new Date());
         cycleCountHeader.setCreatedBy(ShiroUtils.getLoginName());
-        cycleCountHeader.setMasterCode(cycleCountHeaderService.createCode());
+        cycleCountHeader.setCode(cycleCountHeaderService.createCode());
         return toAjax(cycleCountHeaderService.save(cycleCountHeader));
     }
 
@@ -171,7 +171,7 @@ public class CycleCountHeaderController extends BaseController {
 
     /**
      *
-     * 生成差异调整单
+     * 生成调整单
      * */
     //@RequiresPermissions("inventory:cyclecountHead:addAdjust")
     @Log(title = "库存-盘点", operating = "新增盘点差异调整单", action = BusinessType.INSERT)
@@ -195,7 +195,7 @@ public class CycleCountHeaderController extends BaseController {
         mmap.put("cyclecountHeader", cyclecountHeader);
 
         CycleCountDetail condition = new CycleCountDetail();
-        condition.setCycleCountHeadCode(cyclecountHeader.getMasterCode());
+        condition.setCycleCountHeadCode(cyclecountHeader.getCode());
         condition.setWarehouseCode(ShiroUtils.getWarehouseCode());
         LambdaQueryWrapper lambda = Wrappers.lambdaQuery(condition);
         List<CycleCountDetail> details =  cycleCountDetailService.list(lambda);
diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/domain/CycleCountHeader.java b/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/domain/CycleCountHeader.java
index 1270805..cc9485d 100644
--- a/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/domain/CycleCountHeader.java
+++ b/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/domain/CycleCountHeader.java
@@ -36,9 +36,9 @@ public class CycleCountHeader implements Serializable {
     /**
      * 盘点主表编号
      */
-    @TableField(value = "masterCode")
+    @TableField(value = "code")
     @ApiModelProperty(value="盘点主表编号")
-    private String masterCode;
+    private String code;
 
     /**
      * 仓库编码
@@ -293,17 +293,17 @@ public class CycleCountHeader implements Serializable {
      *
      * @return masterCode - 盘点主表编号
      */
-    public String getMasterCode() {
-        return masterCode;
+    public String getCode() {
+        return code;
     }
 
     /**
      * 设置盘点主表编号
      *
-     * @param masterCode 盘点主表编号
+     * @param code 盘点主表编号
      */
-    public void setMasterCode(String masterCode) {
-        this.masterCode = masterCode;
+    public void setCode(String code) {
+        this.code = code;
     }
 
     /**
diff --git a/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java
index e01fb1a..14c9914 100644
--- a/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java
+++ b/src/main/java/com/huaheng/pc/inventory/cycleCountHeader/service/CycleCountHeaderServiceImpl.java
@@ -53,13 +53,13 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap
         //完成时在全部单据都完成后才能修改主单状态为完成
 
         CycleCountHeader cyclecountHeader = new CycleCountHeader();
-        cyclecountHeader.setMasterCode(cycleCountHeaderCode);
+        cyclecountHeader.setCode(cycleCountHeaderCode);
         cyclecountHeader.setWarehouseCode(ShiroUtils.getWarehouseCode());
         LambdaQueryWrapper<CycleCountHeader> lamb = Wrappers.lambdaQuery(cyclecountHeader);
         cyclecountHeader = this.getOne(lamb);
 
         CycleCountDetail temp = new CycleCountDetail();
-        temp.setCycleCountHeadCode(cyclecountHeader.getMasterCode());
+        temp.setCycleCountHeadCode(cyclecountHeader.getCode());
         temp.setWarehouseCode(cyclecountHeader.getWarehouseCode());
         temp.setCompanyCode(cyclecountHeader.getCompanyCode());
         LambdaQueryWrapper<CycleCountDetail> lam = Wrappers.lambdaQuery(temp);
@@ -144,12 +144,12 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap
             return AjaxResult.error("id为"+id.toString()+"的盘点单不存在出,操作中止");
         }
         if(cyclecountHeader.getStatusCyc() > 0){
-            return AjaxResult.error("盘点单:"+cyclecountHeader.getMasterCode()+"非新建状态,无法删除,操作中止");
+            return AjaxResult.error("盘点单:"+cyclecountHeader.getCode()+"非新建状态,无法删除,操作中止");
         }
         //批量删除子单据
         CycleCountDetail temp = new CycleCountDetail();
         temp.setWarehouseCode(ShiroUtils.getWarehouseCode());
-        temp.setCycleCountHeadCode(cyclecountHeader.getMasterCode());
+        temp.setCycleCountHeadCode(cyclecountHeader.getCode());
         LambdaQueryWrapper lm = Wrappers.lambdaQuery(temp);
         cycleCountDetailService.remove(lm);
         cycleCountHeaderMapper.deleteById(id);
@@ -179,7 +179,7 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap
         adjustHeader.setWarehouseCode(ShiroUtils.getWarehouseCode());//仓库
         adjustHeader.setCode(adjustHeaderService.createCode());//生成差异单号
         adjustHeader.setProblemType("盘点调整");
-        adjustHeader.setCycleCountCode(cyclecountHeader.getMasterCode());
+        adjustHeader.setCycleCountCode(cyclecountHeader.getCode());
         adjustHeader.setCompanyCode(cyclecountHeader.getCompanyCode());
         adjustHeader.setCreated(new Date());
         adjustHeader.setCreatedBy(ShiroUtils.getLoginName());
@@ -189,7 +189,7 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap
 
         //根据盘点单查询明细并写入调整单
         CycleCountDetail cycleCountDetail = new CycleCountDetail();
-        cycleCountDetail.setCycleCountHeadCode(cyclecountHeader.getMasterCode());
+        cycleCountDetail.setCycleCountHeadCode(cyclecountHeader.getCode());
         cycleCountDetail.setWarehouseCode(cyclecountHeader.getWarehouseCode());
         LambdaQueryWrapper lam = Wrappers.lambdaQuery(cycleCountDetail);
         List<CycleCountDetail> cycleCountDetailList = cycleCountDetailService.list(lam);
@@ -206,7 +206,7 @@ public class CycleCountHeaderServiceImpl extends ServiceImpl<CycleCountHeaderMap
                 adjustDetail.setCompanyCode(adjustHeader.getCompanyCode());
                 adjustDetail.setLocationCode(item.getLocationCode());
                 adjustDetail.setContainerCode(item.getContainerCode());
-                adjustDetail.setCycleCountCode(cyclecountHeader.getMasterCode());
+                adjustDetail.setCycleCountCode(cyclecountHeader.getCode());
                 adjustDetail.setMaterialCode(item.getMaterialCode());
                 adjustDetail.setMaterialName(item.getMaterialName());
                 adjustDetail.setMaterialSpec(item.getMaterialSpec());
diff --git a/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java b/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java
index 298fc69..24a90d6 100644
--- a/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java
+++ b/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderService.java
@@ -27,7 +27,9 @@ public interface TaskHeaderService extends IService<TaskHeader>{
 
     AjaxResult createCheckOutTask(String[] ids);
 
-    AjaxResult completeCycleCountOrSeeOutTask(TaskHeader taskHeader);
+    AjaxResult completeSeeOutTask(TaskHeader taskHeader);
+
+    AjaxResult completeCycleCountTask(TaskHeader taskHeader);
 
     AjaxResult createReceiptTask(List<Integer> ids);
 
diff --git a/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java b/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
index d7cf81b..65625bb 100644
--- a/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
+++ b/src/main/java/com/huaheng/pc/task/taskHeader/service/TaskHeaderServiceImpl.java
@@ -52,6 +52,8 @@ import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import java.util.*;
+import java.util.concurrent.CopyOnWriteArrayList;
+
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
 import com.huaheng.pc.task.taskHeader.mapper.TaskHeaderMapper;
@@ -419,27 +421,31 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
     @Transactional
     public void completeTask(TaskHeader task) {
         //区分任务类型
-        if (task.getInternalTaskType() == 100) {
+        if (task.getTaskType() == 100) {
             //入库任务
             completeReceiptTask(task);
         }
-        if (task.getInternalTaskType() == 200) {
+        if (task.getTaskType() == 200) {
 //            出库任务
             completeShipmentTask(task);
         }
-        // 700 盘点    900 出库查看,包过空托出库查看
-        if (task.getInternalTaskType() == 700 || task.getInternalTaskType() == 900) {
-            completeCycleCountOrSeeOutTask(task);
+        // 900 出库查看,包过空托出库查看
+        if ( task.getTaskType() == 900) {
+            completeSeeOutTask(task);
+        }
+        // 700 盘点
+        if ( task.getTaskType() == 700) {
+            completeCycleCountTask(task);
         }
-        if (task.getInternalTaskType() == 800) {
+        if (task.getTaskType() == 800) {
 //          //移库
             completeTransferTask(task);
         }
-        if (task.getInternalTaskType() == 500) {
+        if (task.getTaskType() == 500) {
             //空托盘入库
            completeEmptyIn(task);
         }
-        if (task.getInternalTaskType() == 600) {
+        if (task.getTaskType() == 600) {
            //空托盘出库
             completeEmptyOut(task);
         }
@@ -863,7 +869,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
             TaskHeader taskHeader = new TaskHeader();
             taskHeader.setWarehouseCode(inventoryHeader.getWarehouseCode());
             taskHeader.setCompanyCode(inventoryHeader.getCompanyCode());//货主
-            taskHeader.setInternalTaskType(200);
+            taskHeader.setInternalTaskType(400);
             taskHeader.setTaskType(900);
             taskHeader.setContainerCode(inventoryHeader.getContainerCode());
             taskHeader.setStatus(1);
@@ -906,12 +912,12 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
 
     /**
      * 完成
-     * 盘点,出库查看
+     * 出库查看
      * 更新状态即可
      */
     @Transactional
     @Override
-    public AjaxResult completeCycleCountOrSeeOutTask(TaskHeader taskHeader) {
+    public AjaxResult completeSeeOutTask(TaskHeader taskHeader) {
         taskHeader.setStatus(100);
         taskHeader.setLastUpdatedBy(ShiroUtils.getLoginName()); //更新用户
         taskHeader.setLastUpdated(new Date());   //更新时间
@@ -922,45 +928,39 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
         taskDetail.setTaskId(taskHeader.getId());
         LambdaQueryWrapper lambdaQueryWrapper = Wrappers.lambdaQuery(taskDetail);
         List<TaskDetail> taskDetailList = taskDetailService.list(lambdaQueryWrapper);//查询子单
-        List<CycleCountDetail> cycleCountDetailList = new ArrayList<>();
-        for (TaskDetail item : taskDetailList) {
+        List<TaskDetail> list = new CopyOnWriteArrayList<>();
+        for(TaskDetail item:taskDetailList){
             item.setStatus(100);
             item.setLastUpdatedBy(ShiroUtils.getLoginName()); //更新用户
             item.setLastUpdated(new Date());   //更新时间
-            taskDetailList.add(item);
-            //盘点完成时,修改盘点详细中的状态为100,库存解锁
-            if (taskDetail.getTaskType() == 700) {
-                //盘点明细的条目由任务明细的数值取出,修改盘点明细状态,
-                // 并判断主单的明细是否已全部完成,然后再修改主单状态
-                CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(item.getBillDetailId());
-                cycleCountDetail.setEnableStatus(100);
-                cycleCountDetail.setCompletedAt(new Date());
-                cycleCountDetail.setCompletedBy(ShiroUtils.getLoginName());
-                cycleCountDetailList.add(cycleCountDetail);
-                //释放库位状态
-                locationService.updateStatus(cycleCountDetail.getLocationCode(), "empty");
-                //更新盘点主单状态
-                if(taskHeader.getTaskType() == 700){
-                    cycleCountHeaderService.updataHeaderStatus(cycleCountDetail.getCycleCountHeadCode());
-                }
-            }
-
+            list.add(item);
         }
-        if (taskDetailService.saveOrUpdateBatch(taskDetailList) == false || taskHeaderService.saveOrUpdate(taskHeader) == false) {
+        if (taskDetailService.saveOrUpdateBatch(list) == false || taskHeaderService.saveOrUpdate(taskHeader) == false) {
             throw new ServiceException("任务单据状态更新失败!");
         }
-        if (cycleCountDetailService.saveOrUpdateBatch(cycleCountDetailList) == false){
-            throw new ServiceException("盘点明细单状态更新失败!");
-        }
-
-        //出库查看释放库位状态
-        if(taskHeader.getTaskType() == 900){
-            locationService.updateStatus(taskHeader.getFromLocation(), "empty");
-        }
+        //释放库位状态
+         locationService.updateStatus(taskHeader.getFromLocation(), "empty");
         return AjaxResult.success("完成出库查看任务");
     }
 
     /**
+     * 盘点完成
+     * @param taskHeader
+     * @return
+     */
+    @Transactional
+    @Override
+    public AjaxResult completeCycleCountTask(TaskHeader taskHeader){
+        /*盘点完成,传入任务主单,查出任务明细,通过任务明细查找盘点的明细单,完成任务同时,修改盘点细单和主单的状态*/
+
+
+
+
+
+        return null;
+    }
+
+    /**
      * 完成空托盘入库任务
      * @param taskHeader
      */
diff --git a/src/main/resources/mybatis/inventory/CycleCountHeaderMapper.xml b/src/main/resources/mybatis/inventory/CycleCountHeaderMapper.xml
index e25f9f4..9afe1f5 100644
--- a/src/main/resources/mybatis/inventory/CycleCountHeaderMapper.xml
+++ b/src/main/resources/mybatis/inventory/CycleCountHeaderMapper.xml
@@ -6,7 +6,7 @@
     <id column="id" jdbcType="INTEGER" property="id" />
     <result column="countOrderId" jdbcType="INTEGER" property="countOrderId" />
     <result column="round" jdbcType="INTEGER" property="round" />
-    <result column="masterCode" jdbcType="VARCHAR" property="masterCode" />
+    <result column="masterCode" jdbcType="VARCHAR" property="code" />
     <result column="warehouseCode" jdbcType="VARCHAR" property="warehouseCode" />
     <result column="companyCode" jdbcType="VARCHAR" property="companyCode" />
     <result column="countType" jdbcType="VARCHAR" property="countType" />
@@ -36,14 +36,14 @@
   </resultMap>
   <sql id="Base_Column_List">
     <!--@mbg.generated-->
-    id, countOrderId, round, masterCode, warehouseCode, companyCode, countType, statusCyc, 
+    id, countOrderId, round, code, warehouseCode, companyCode, countType, statusCyc,
     countAttribute, remark, totalLocs, totalItems, zoneCode, locationFilter, releasedBy, 
     releasedAt, closedBy, closedAt, created, createdBy, lastUpdated, lastUpdatedBy, version, 
     userDef1, userDef2, userDef3, verifyBy, sourceCode, uploadTime, uploadStatus
   </sql>
 
     <select id="getLastCode" resultType="java.lang.String">
-        SELECT masterCode FROM cycle_count_header ORDER BY id DESC LIMIT 1
+        SELECT code FROM cycle_count_header ORDER BY id DESC LIMIT 1
     </select>
 
 
diff --git a/src/main/resources/static/file/物料.xls b/src/main/resources/static/file/物料.xls
deleted file mode 100644
index 1bf9ce2..0000000
--- a/src/main/resources/static/file/物料.xls
+++ /dev/null
@@ -1 +0,0 @@
-����	code
diff --git a/src/main/resources/templates/config/company/edit.html b/src/main/resources/templates/config/company/edit.html
index 64d5b8f..937239a 100644
--- a/src/main/resources/templates/config/company/edit.html
+++ b/src/main/resources/templates/config/company/edit.html
@@ -18,14 +18,14 @@
                     <input id="name" name="name" th:field="*{name}" class="form-control" type="text">
                 </div>
             </div>
-            <div class="form-group">
-                <label class="col-sm-3 control-label">仓库:</label>
-                <div class="col-sm-8">
-                    <select id="warehouseCode" name="warehouseCode" class="form-control" >
-                        <option th:each="item : ${warehouseList}" th:text="${item['name']}" th:value="${item['code']}" th:attr = " code = ${item['name']}"></option>
-                    </select>
-                </div>
-            </div>
+            <!--<div class="form-group">-->
+                <!--<label class="col-sm-3 control-label">仓库:</label>-->
+                <!--<div class="col-sm-8">-->
+                    <!--<select id="warehouseCode" name="warehouseCode" class="form-control" >-->
+                        <!--<option th:each="item : ${warehouseList}" th:text="${item['name']}" th:value="${item['code']}" th:attr = " code = ${item['name']}"></option>-->
+                    <!--</select>-->
+                <!--</div>-->
+            <!--</div>-->
             <div class="form-group">	
                 <label class="col-sm-3 control-label">地址1:</label>
                 <div class="col-sm-8">
diff --git a/src/main/resources/templates/config/container/container.html b/src/main/resources/templates/config/container/container.html
index 3bf0e29..2e1399e 100644
--- a/src/main/resources/templates/config/container/container.html
+++ b/src/main/resources/templates/config/container/container.html
@@ -24,7 +24,7 @@
 							<li>
 								容器类型:<select name="containerType" th:with="containerType = ${@containerType.getCode()}">
 								<option value="">所有</option>
-								<option th:each="item : ${containerType}" th:text="${item['name']}" th:value="${item['prefix']}"></option>
+								<option th:each="item : ${containerType}" th:text="${item['name']}" th:value="${item['code']}"></option>
 							</select>
 							</li>
 							<li class="time">
@@ -102,10 +102,10 @@
 				{
 					field : 'containerType',
 					title : '容器类型',
-                    align: 'center',
-                    formatter: function(value, row, index) {
-                        return $.table.selectPrefixToName(containerTypes, value);
-                    }
+                    // align: 'center',
+                    // formatter: function(value, row, index) {
+                    //     return $.table.selectPrefixToName(containerTypes, value);
+                    // }
 				},
 				{
 					field : 'locationCode', 
diff --git a/src/main/resources/templates/config/location/add.html b/src/main/resources/templates/config/location/add.html
index a26f10a..14cafc4 100644
--- a/src/main/resources/templates/config/location/add.html
+++ b/src/main/resources/templates/config/location/add.html
@@ -33,7 +33,7 @@
 				<label class="col-sm-3 control-label">库位类型:</label>
 				<div class="col-sm-8">
                     <select id="locationType" name="locationType" class="form-control" th:with="locationType=${@locationType.getLocationPrefix()}">
-                        <option th:each="item : ${locationType}" th:text="${item['name']}" th:value="${item['prefix']}"></option>
+                        <option th:each="item : ${locationType}" th:text="${item['name']}" th:value="${item['code']}"></option>
                     </select>
 				</div>
 			</div>
@@ -48,8 +48,8 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">库位状态:</label>
 				<div class="col-sm-8">
-					<select id="status" name="status" class="form-control" th:with="statusList=${@dict.getType('locationStatus')}">
-						<option th:each="item : ${statusList}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option>
+					<select id="status" name="status" class="form-control" th:with="status=${@dict.getType('locationStatus')}">
+						<option th:each="item : ${status}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option>
 					</select>
 				</div>
 			</div>
@@ -66,30 +66,22 @@
 		var prefix = ctx + "config/location"
 		$("#form-location-add").validate({
             rules:{
-                row:{
+				iRow:{
                     required:true,
                     digits:true
                 },
-                line:{
+				iColumn:{
                     required:true,
                     digits:true
                 },
-                layer:{
+				iLayer:{
                     required:true,
                     digits:true
                 },
-                grid:{
+				iGrid:{
                     required:true,
                     digits:true
-                },
-                rowIndex:{
-                    required:true,
-                    range:[1,4]
-                },
-                roadway:{
-                    required:true,
-                    min:0
-                },
+                }
             },
 			submitHandler: function(form) {
                 $.ajax({
@@ -101,9 +93,9 @@
                         "iColumn": $("input[name='iColumn']").val(),
                         "iLayer": $("input[name='iLayer']").val(),
                         "iGrid": $("input[name='iGrid']").val(),
-                        "locationType": $("#type option:selected").val(),
+                        "locationType": $("#locationType option:selected").val(),
                         "zoneCode": $("#zoneCode option:selected").attr("code"),
-                        "enable" : $("input[name='enable']").is(':checked'),
+                        "status" : $("#status option:selected").val(),
                     },
                     async : false,
                     error : function(request) {
diff --git a/src/main/resources/templates/config/location/addBatch.html b/src/main/resources/templates/config/location/addBatch.html
index 917d117..972b851 100644
--- a/src/main/resources/templates/config/location/addBatch.html
+++ b/src/main/resources/templates/config/location/addBatch.html
@@ -29,12 +29,12 @@
 					<input id="iGrid" name="iGrid" class="form-control" type="text">
 				</div>
 			</div>
-			<div class="form-group">	
+			<div class="form-group">
 				<label class="col-sm-3 control-label">库位类型:</label>
 				<div class="col-sm-8">
-                    <select id="locationType" class="form-control" th:with="locationType=${@locationType.getLocationPrefix()}">
-                        <option th:each="item : ${locationType}" th:text="${item['name']}" th:value="${item['code']}"></option>
-                    </select>
+					<select id="locationType" name="locationType" class="form-control" th:with="locationType=${@locationType.getLocationPrefix()}">
+						<option th:each="item : ${locationType}" th:text="${item['name']}" th:value="${item['code']}"></option>
+					</select>
 				</div>
 			</div>
 			<div class="form-group">
@@ -48,8 +48,8 @@
 			<div class="form-group">
 				<label class="col-sm-3 control-label">库位状态:</label>
 				<div class="col-sm-8">
-					<select id="status" name="status" class="form-control" th:with="statusList=${@dict.getType('locationStatus')}">
-						<option th:each="item : ${statusList}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option>
+					<select id="status" name="status" class="form-control" th:with="status=${@dict.getType('locationStatus')}">
+						<option th:each="item : ${status}" th:text="${item['dictLabel']}" th:value="${item['dictValue']}"></option>
 					</select>
 				</div>
 			</div>
@@ -66,22 +66,33 @@
 		var prefix = ctx + "config/location"
 		$("#form-location-add").validate({
             rules:{
-                row:{
+				iRow:{
                     required:true,
                     digits:true
                 },
-                line:{
+				iColumn:{
                     required:true,
                     digits:true
                 },
-                layer:{
+				iLayer:{
                     required:true,
                     digits:true
                 },
-                grid:{
+				iGrid:{
                     required:true,
                     digits:true
-                }
+                },
+				zoneCode:{
+					required:true,
+					digits:true
+				},
+				locationType:{
+					required:true
+				},
+				// status:{
+				// 	required:true,
+				// 	digits:true
+				// }
             },
 			submitHandler: function(form) {
                 $.ajax({
@@ -95,7 +106,7 @@
                         "iGrid": $("input[name='iGrid']").val(),
                         "locationType": $("#locationType option:selected").val(),
                         "zoneCode": $("#zone option:selected").attr("code"),
-                        "enable" : $("input[name='enable']").is(':checked'),
+                        "status" : $("#status option:selected").val(),
                     },
                     async : false,
                     error : function(request) {
diff --git a/src/main/resources/templates/config/location/location.html b/src/main/resources/templates/config/location/location.html
index 4a6a884..8719e3c 100644
--- a/src/main/resources/templates/config/location/location.html
+++ b/src/main/resources/templates/config/location/location.html
@@ -25,25 +25,25 @@
 							库区编码:<input type="text" name="zoneCode"/>
 						</li>
 						<li>
-							行:<input type="text" name="row"/>
+							行:<input type="text" name="iRow"/>
 						</li>
 						<li>
-							列:<input type="text" name="line"/>
+							列:<input type="text" name="iColumn"/>
 						</li>
 						<li>
-							层:<input type="text" name="layer"/>
+							层:<input type="text" name="iLayer"/>
 						</li>
 						<li>
-							格:<input type="text" name="grid"/>
-						</li>
-						<li>
-							巷道:<input type="text" name="roadway"/>
+							格:<input type="text" name="iGrid"/>
 						</li>
 						<!--<li>-->
+							<!--巷道:<input type="text" name="roadway"/>-->
+						<!--</li>-->
+						<!--<li>-->
 							<!--名称:<input type="text" name="name"/>-->
 						<!--</li>-->
 						<li>
-							库位类型:<select name="type" th:with="locationTypes = ${@locationType.getLocationPrefix()}">
+							库位类型:<select name="locationType" th:with="locationTypes = ${@locationType.getLocationPrefix()}">
 							<option value="">所有</option>
 							<option th:each="e : ${locationTypes}" th:text="${e['name']}" th:value="${e['code']}"></option>
 						</select>
diff --git a/src/main/resources/templates/config/locationType/locationType.html b/src/main/resources/templates/config/locationType/locationType.html
index f8fcd17..51504d8 100644
--- a/src/main/resources/templates/config/locationType/locationType.html
+++ b/src/main/resources/templates/config/locationType/locationType.html
@@ -10,7 +10,7 @@
 					<div class="select-list">
 						<ul>
 							<li>
-								编码:<input type="text" name="code"/>
+								货位类型:<input type="text" name="code"/>
 							</li>
 							<li>
 								名称:<input type="text" name="name"/>
@@ -107,10 +107,6 @@
 						title : '校验位'
 					},
 					{
-						field : 'checkDigit',
-						title : '校验位'
-					},
-					{
 						field : 'maxMaterials',
 						title : '最多混放物料数'
 					},
diff --git a/src/main/resources/templates/config/material/material.html b/src/main/resources/templates/config/material/material.html
index d48e6e7..4c91f8b 100644
--- a/src/main/resources/templates/config/material/material.html
+++ b/src/main/resources/templates/config/material/material.html
@@ -29,9 +29,9 @@
 							</li>
 							<li class="time">
 								<label>创建时间: </label>
-								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[createdBegin]"/>
+								<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="createdBegin"/>
 								<span>-</span>
-								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[createdEnd]"/>
+								<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="createdEnd"/>
 							</li>
 							<li>
 								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
@@ -206,7 +206,7 @@
 		            align: 'center',
 		            formatter: function(value, row, index) {
 		            	var actions = [];
-		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
+		            	// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>');
                         return actions.join('');
 		            }
diff --git a/src/main/resources/templates/config/warehouse/warehouse.html b/src/main/resources/templates/config/warehouse/warehouse.html
index f8e3420..5516b60 100644
--- a/src/main/resources/templates/config/warehouse/warehouse.html
+++ b/src/main/resources/templates/config/warehouse/warehouse.html
@@ -213,7 +213,7 @@
 		            formatter: function(value, row, index) {
 		            	var actions = [];
 		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick= edit(\''+row.code+'\')><i class="fa fa-edit"></i>编辑</a> ');
-                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(' + row.code + ')"><i class="fa fa-trash-o"></i>删除</a>');
+                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick=removes(\''+row.code+'\')><i class="fa fa-trash-o"></i>删除</a>');
 						return actions.join('');
 		            }
 		        }]
@@ -225,6 +225,15 @@
         	var url = prefix + "/edit/"+code;
 			$.modal.open("修改" + $.table._option.modalName, url);
 		}
+
+		// 删除信息
+		function removes(code) {
+			$.modal.confirm("确定删除该条" + $.table._option.modalName + "信息吗?", function() {
+				var url = $.common.isEmpty(code) ? $.table._option.removeUrl : $.table._option.removeUrl.replace("{code}", code);
+				var data = { "codes": code };
+				$.operate.submit(url, "post", "json", data);
+			});
+		}
     </script>
 </body>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/templates/config/zoneCapacity/zoneCapacity.html b/src/main/resources/templates/config/zoneCapacity/zoneCapacity.html
index 265f6a5..b9e1597 100644
--- a/src/main/resources/templates/config/zoneCapacity/zoneCapacity.html
+++ b/src/main/resources/templates/config/zoneCapacity/zoneCapacity.html
@@ -10,13 +10,10 @@
 					<div class="select-list">
 						<ul>
 							<li>
-								编码:<input type="text" name="code"/>
+								商品编码:<input type="text" name="materialCode"/>
 							</li>
 							<li>
-								名称:<input type="text" name="name"/>
-							</li>
-							<li>
-								存货编码:<input type="text" name="materialId"/>
+								商品名称:<input type="text" name="materialName"/>
 							</li>
 							</li>
 							<li>
diff --git a/src/main/resources/templates/inventory/cycleCountDetail/add.html b/src/main/resources/templates/inventory/cycleCountDetail/add.html
index 233fcf0..f1de843 100644
--- a/src/main/resources/templates/inventory/cycleCountDetail/add.html
+++ b/src/main/resources/templates/inventory/cycleCountDetail/add.html
@@ -8,7 +8,7 @@
 	<div class="row">
 		<div class="col-sm-12 select-info">
 			<form id="inventory-form">
-                <input type="hidden" id="cycleCountHeadId" name="cycleCountHeadId" th:value="${cycleCountHeadId}">
+                <input type="hidden" id="cycleCountHeadCode" name="cycleCountHeadCode" th:value="${cycleCountHeadCode}">
 					<div class="select-list">
 						<ul>
                             <ul>
@@ -329,16 +329,16 @@
         rows.forEach(function (item) {
 			ids.push(item.id);
         });
-        addInner($('#cycleCountHeadId').val(),ids.join(','));
+        addInner($('#cycleCountHeadCode').val(),ids.join(','));
     }
 
-    function addInner(cycleCountHeadId,ids) {
+    function addInner(cycleCountHeadCode,ids) {
         $.ajax({
             cache : true,
             type : "post",
             url : prefix_cycleDetails + "/add",
             data:{
-                cycleCountHeadId:cycleCountHeadId,
+                cycleCountHeadCode:cycleCountHeadCode,
                 inventoryDetailIdIds:ids
             },
             async : false,
diff --git a/src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html b/src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html
index 2718793..7231b96 100644
--- a/src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html
+++ b/src/main/resources/templates/inventory/cycleCountDetail/cycleCountDetail.html
@@ -10,7 +10,7 @@
                 <ul>
                     <li>
                         <form id="cycleHeader-form">
-                            盘点主ID:<input type="text" id="cycleCountHeadCode" name="cycleCountHeadCode" readonly="readonly" />
+                            盘点主单编码:<input type="text" id="cycleCountHeadCode" name="cycleCountHeadCode" readonly="readonly" />
                         </form>
                     </li>
                     <li>
diff --git a/src/main/resources/templates/inventory/cycleCountHeader/add.html b/src/main/resources/templates/inventory/cycleCountHeader/add.html
index d12cf2a..830d84e 100644
--- a/src/main/resources/templates/inventory/cycleCountHeader/add.html
+++ b/src/main/resources/templates/inventory/cycleCountHeader/add.html
@@ -33,9 +33,12 @@
             <div class="form-group">
                 <label class="col-sm-3 control-label">货主:</label>
                 <div class="col-sm-8">
-                    <input id="companyCode" name="companyCode" class="form-control" type="text">
+                    <select id="companyCode" name="companyCode" class="form-control" th:with="list=${@companyService.getCode()}">
+                        <option th:each="item : ${list}" th:text="${item['name']}" th:value="${item['code']}" th:attr = " code = ${item['code']}"></option>
+                    </select>
                 </div>
             </div>
+
             <div class="form-group">
                 <label class="col-sm-3 control-label">总货位数:</label>
                 <div class="col-sm-8">
diff --git a/src/main/resources/templates/inventory/cycleCountHeader/cycleCountHeader.html b/src/main/resources/templates/inventory/cycleCountHeader/cycleCountHeader.html
index 2051148..11bb5bd 100644
--- a/src/main/resources/templates/inventory/cycleCountHeader/cycleCountHeader.html
+++ b/src/main/resources/templates/inventory/cycleCountHeader/cycleCountHeader.html
@@ -31,7 +31,7 @@
                                         源盘点单号:<input type="text" name="sourceCode"/>
                                     </li>
                                     <li>
-                                        盘点主表编号:<input type="text" name="masterCode"/>
+                                        盘点单编码:<input type="text" name="code"/>
                                     </li>
                                     <li>
                                         原始盘点ID:<input type="text" name="countOrderId"/>
@@ -108,9 +108,13 @@
             sortName: "created",
             sortOrder: "desc",
             search: false,
+
             // onDblClickRow: function (row) {
             //     showDetail(row.id,row.code);
             // },
+            onDblClickRow:function(row){
+                 detail(row.id,row.masterCode);
+            },
             columns: [{
                 checkbox: true
             },
@@ -120,8 +124,8 @@
                     sortable: true
                 },
                 {
-                    field: 'masterCode',
-                    title: '盘点单号'
+                    field: 'code',
+                    title: '盘点单编码'
                 },
                 {
                     field: 'warehouseCode',
@@ -288,10 +292,10 @@
         });
     });
 
-    function detail(id) {
+    function detail(id,code) {
         let url = ctx + "inventory/cycleCountDetail";
-        if (id) {
-            url = ctx + "inventory/cycleCountDetail?id=" + id;
+        if (code) {
+            url = ctx + "inventory/cycleCountDetail?cycleCountHeadCode=" + code;
         }
         $("#tabDetail").children().remove();
         $("#myTab li").removeClass("active");