diff --git a/ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizComponentModal.vue b/ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizComponentModal.vue
index 8941622..58814bc 100644
--- a/ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizComponentModal.vue
+++ b/ant-design-vue-jeecg/src/components/jeecgbiz/JButtonBizComponent/JSelectBizComponentModal.vue
@@ -189,7 +189,7 @@ export default {
     // 表头
     innerColumns() {
       let columns = cloneDeep(this.columns)
-      debugger
+
       columns.forEach(column => {
         // 给所有的列加上过长裁剪
         if (this.ellipsisLength !== -1) {
diff --git a/ant-design-vue-jeecg/src/views/system/stocktaking/modules/AdjustmentDocModal.vue b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/AdjustmentDocModal.vue
index 28a2062..635a9ad 100644
--- a/ant-design-vue-jeecg/src/views/system/stocktaking/modules/AdjustmentDocModal.vue
+++ b/ant-design-vue-jeecg/src/views/system/stocktaking/modules/AdjustmentDocModal.vue
@@ -1,3 +1,4 @@
+<script src="../../../../components/jeecgbiz/JButtonBizComponent/util.js"></script>
 <template>
   <j-modal
     :title="title"
@@ -26,6 +27,7 @@
 
 import {createManyEmptyIn} from '@/api/api'
 import {confirmGapQty} from "../../../../api/api";
+import Utils from '../../../../components/jeecgbiz/JButtonBizComponent/util.js';
 
 export default {
   name: "AdjustmentDocModal",
@@ -95,6 +97,7 @@ export default {
               that.$emit('ok');
               that.model.containerCode = '';
               that.model.toLocationCode = '';
+              Utils.$emit('methodB',res.result);
             } else {
               that.$message.warning(res.message);
             }
diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java
index 41dce0c..4602fc6 100644
--- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java
+++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/entity/CycleCountDetail.java
@@ -2,6 +2,7 @@ package org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity;
 
 import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
+import java.math.BigDecimal;
 import java.util.Date;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -74,15 +75,15 @@ public class CycleCountDetail implements Serializable {
 	/**系统数量*/
 	@Excel(name = "系统数量", width = 15)
     @ApiModelProperty(value = "系统数量")
-    private Integer systemQty;
+    private BigDecimal systemQty;
 	/**实盘数量*/
 	@Excel(name = "实盘数量", width = 15)
     @ApiModelProperty(value = "实盘数量")
-    private Integer countedQty;
+    private BigDecimal countedQty;
 	/**差异数量*/
 	@Excel(name = "差异数量", width = 15)
     @ApiModelProperty(value = "差异数量")
-    private Integer gapQty;
+    private BigDecimal gapQty;
 	/**失败原因*/
 	@Excel(name = "失败原因", width = 15)
     @ApiModelProperty(value = "失败原因")
diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java
index 48df846..ae27944 100644
--- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java
+++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailChildServiceImpl.java
@@ -2,7 +2,10 @@ package org.jeecg.modules.wms.stocktaking.cycleCountDetail.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.modules.system.entity.SysThirdAccount;
 import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetail;
 import org.jeecg.modules.wms.stocktaking.cycleCountDetail.entity.CycleCountDetailChild;
 import org.jeecg.modules.wms.stocktaking.cycleCountDetail.mapper.CycleCountDetailChildMapper;
@@ -51,29 +54,53 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl<CycleCountDeta
 		if(StringUtils.isNull(countDetailChild)){
 			return Result.error("明细子单不存在!");
 		}
+
+
+
 		CycleCountDetail cycleCountDetail = cycleCountDetailService.getById(countDetailChild.getCycleCountDetailid());
 		if(StringUtils.isNull(cycleCountDetail)){
 			return Result.error("盘点明细不存在。");
 		}
 		//任务完成后再实盘登记
-       /* if(countDetailChild.getChildStatus() < QuantityConstant.CYCLECOUNT_STATUS_EXECUTING){
-            return AjaxResult.error("盘点任务未执行不能登记数量!");
-        }*/
+//        if(countDetailChild.getChildStatus() < QuantityConstant.CYCLECOUNT_STATUS_EXECUTING){
+//            return AjaxResult.error("盘点任务未执行不能登记数量!");
+//        }
 
 		if(countDetailChild.getChildStatus() >= QuantityConstant.CYCLECOUNT_STATUS_COMPLETED){
 			return Result.error("盘点任务完成后不能再登记数量!");
 		}
+
+
 		//实盘登记后差异数量
 		BigDecimal adjQty = qty.subtract(countDetailChild.getSystemQty());
 		countDetailChild.setGapQty(adjQty);
 		countDetailChild.setCountedQty(qty);
 		countDetailChild.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED);
-//		countDetailChild.setCountedBy(ShiroUtils.getLoginName());
 		this.updateById(countDetailChild);
+
+
+
+		LambdaQueryWrapper<CycleCountDetailChild> cycleCountDetailChildLambdaQueryWrapper = new LambdaQueryWrapper<>();
+		cycleCountDetailChildLambdaQueryWrapper.eq(CycleCountDetailChild::getCycleCountDetailid,cycleCountDetail.getId());
+		List<CycleCountDetailChild> cycleCountDetailChildren = this.list(cycleCountDetailChildLambdaQueryWrapper);
+
+		BigDecimal counted_qty=new BigDecimal(0);
+		BigDecimal ystem_qty=new BigDecimal(0);
+		BigDecimal gap_qty=new BigDecimal(0);
+		for(CycleCountDetailChild cycleCountDetailChild:cycleCountDetailChildren)
+		{
+			counted_qty=counted_qty.add(cycleCountDetailChild.getCountedQty());
+			ystem_qty=ystem_qty.add(cycleCountDetailChild.getSystemQty());
+			gap_qty=gap_qty.add(cycleCountDetailChild.getGapQty());
+		}
 		//修改明细单状态
 		cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED);
-		cycleCountDetailService.updateById(cycleCountDetail);
+		cycleCountDetail.setCountedQty(counted_qty);
+		cycleCountDetail.setSystemQty(ystem_qty);
+		cycleCountDetail.setGapQty(gap_qty);
 
+		cycleCountDetailService.updateById(cycleCountDetail);
+		LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
 		//修改主单状态
 		CycleCountHeader tmp = new CycleCountHeader();
 		tmp.setCode(countDetailChild.getCyclecountheadcode());
@@ -81,8 +108,12 @@ public class CycleCountDetailChildServiceImpl extends ServiceImpl<CycleCountDeta
 		LambdaQueryWrapper<CycleCountHeader> lambdaQueryWrapper = Wrappers.lambdaQuery(tmp);
 		CycleCountHeader cycleCountHeader = cycleCountHeaderService.getOne(lambdaQueryWrapper);
 		cycleCountHeader.setStatusCyc(QuantityConstant.CYCLECOUNT_STATUS_REGISTERED);
-//		cycleCountHeaderService.updataHeaderStatus(cycleCountHeader.getCode());
+		cycleCountHeader.setStocktakingAc(sysUser.getUsername());
 
-		return Result.ok("调整成功");
+		Result result = new Result();
+		result.setCode(200);
+		result.setMessage("调整成功");
+		result.setResult(cycleCountHeader.getId());
+		return result;
 	}
 }
diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
index 45aaff3..61c0a90 100644
--- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
+++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountDetail/service/impl/CycleCountDetailServiceImpl.java
@@ -119,17 +119,14 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap
 		inventoryDetailLambdaQueryWrapper.eq(InventoryDetail::getInventoryHeaderId,taskId);
 		List<InventoryDetail> inventoryDetails = inventoryDetailService.list(inventoryDetailLambdaQueryWrapper);
 
-		LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
-		locationLambdaQueryWrapper.eq(Location::getCode, inventoryDetails.get(0).getLocationCode())
-				.eq(Location::getWarehouseCode, inventoryDetails.get(0).getWarehouseCode())
-				.ne(Location::getStatus, QuantityConstant.STATUS_LOCATION_LOCK);
-		Location location = locationService.getOne(locationLambdaQueryWrapper);
-		if (StringUtils.isNull(location)) {
-			return Result.error("库位已锁定!");
-		}
-
-		LambdaQueryWrapper<CycleCountDetail> cycleCountDetailLambdaQueryWrapper = Wrappers.lambdaQuery();
-
+//		LambdaQueryWrapper<Location> locationLambdaQueryWrapper = Wrappers.lambdaQuery();
+//		locationLambdaQueryWrapper.eq(Location::getCode, inventoryDetails.get(0).getLocationCode())
+//				.eq(Location::getWarehouseCode, inventoryDetails.get(0).getWarehouseCode())
+//				.ne(Location::getStatus, QuantityConstant.STATUS_LOCATION_LOCK);
+//		Location location = locationService.getOne(locationLambdaQueryWrapper);
+//		if (StringUtils.isNull(location)) {
+//			return Result.error("库位已锁定!");
+//		}
 
 		CycleCountDetail cycleCountDetail = new CycleCountDetail();
 		cycleCountDetail.setCycleCountHeadId(headerId);
@@ -143,9 +140,9 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap
 		cycleCountDetail.setInventoryHeaderId(inventoryDetails.get(0).getInventoryHeaderId());
 		cycleCountDetail.setLocationCode(inventoryDetails.get(0).getLocationCode());
 		cycleCountDetail.setInventorySts(inventoryDetails.get(0).getInventoryStatus());
-		cycleCountDetail.setSystemQty(inventoryDetails.size());
-		cycleCountDetail.setCountedQty(0);
-		cycleCountDetail.setGapQty(0);
+		cycleCountDetail.setSystemQty(BigDecimal.ZERO);
+		cycleCountDetail.setCountedQty(BigDecimal.ZERO);
+		cycleCountDetail.setGapQty(BigDecimal.ZERO);
 		cycleCountDetail.setEnableStatus(QuantityConstant.CYCLECOUNT_STATUS_BUILD);
 		this.save(cycleCountDetail);
 
@@ -293,6 +290,7 @@ public class CycleCountDetailServiceImpl extends ServiceImpl<CycleCountDetailMap
 		result.setCode(200);
 		result.setMessage("盘点任务生成成功");
 
+
 		return result;
 	}
 
diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/entity/CycleCountHeader.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/entity/CycleCountHeader.java
index b70ce3b..8671fbf 100644
--- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/entity/CycleCountHeader.java
+++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/stocktaking/cycleCountHeader/entity/CycleCountHeader.java
@@ -75,7 +75,7 @@ public class CycleCountHeader implements Serializable {
 	/**总物料数*/
 	@Excel(name = "总物料数", width = 15)
     @ApiModelProperty(value = "总物料数")
-    private Integer totalItems;
+    private BigDecimal totalItems;
 	/**审核人*/
 	@Excel(name = "审核人", width = 15)
     @ApiModelProperty(value = "审核人")
diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
index 7692399..4f60d12 100644
--- a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
+++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/task/taskHeader/service/impl/TaskHeaderServiceImpl.java
@@ -11,6 +11,7 @@ import java.util.stream.Collectors;
 
 import javax.annotation.Resource;
 
+import org.apache.poi.hpsf.Decimal;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.vo.LoginUser;
@@ -1547,6 +1548,8 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
         //3.单据list如果差异数量+生成入库单,差异数-生成出库单进行回传类型其他出库单
 
 
+        InventoryHeader inventoryHeader = inventoryHeaderService.getById(cycleCountDetail.getInventoryHeaderId());
+
         int outboundOrderId=0;
         String outboundOrderCode=null;
         int warehousingOrderId=0;
@@ -1555,6 +1558,17 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
 
         for (CycleCountDetailChild child : children)
         {
+            InventoryDetail inventoryDetail = inventoryDetailService.getById(child.getInventoryDetaiId());
+            if (inventoryDetail==null)
+            {
+                return Result.error("盘点还没完成 库存明细单据就不存在了 可能出现了问题或者所容器没成功");
+            }
+
+            inventoryHeader.setTotalQty(inventoryHeader.getTotalQty().add(child.getGapQty()));
+
+            inventoryDetail.setQty(child.getCountedQty());
+            inventoryDetailService.updateById(inventoryDetail);
+
             child.setChildStatus(QuantityConstant.CYCLECOUNT_STATUS_COMPLETED);
             if (child.getGapQty().compareTo(BigDecimal.ZERO) == 1)
             {
@@ -1582,7 +1596,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
                 receiptDetail.setReceiptId(warehousingOrderId);
                 receiptDetail.setReceiptCode(warehousingOrderCode);
                 receiptDetail.setWarehouseCode(taskHeader.getWarehouseCode());
-                receiptDetail.setCompanyCode(null);
+                receiptDetail.setCompanyCode(taskHeader.getCompanyCode());
                 receiptDetail.setMaterialCode(child.getMaterialCode());
                 receiptDetail.setMaterialName(child.getMaterialName());
                 receiptDetail.setMaterialSpec(child.getMaterialSpec());
@@ -1595,10 +1609,38 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
                 receiptDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED);
                 receiptDetailService.save(receiptDetail);
 
+                //增加库存交易记录
+                InventoryTransaction inventoryTransaction=new InventoryTransaction();
+                inventoryTransaction.setWarehouseCode(taskHeader.getWarehouseCode());
+                inventoryTransaction.setCompanyCode(taskHeader.getCompanyCode());
+                inventoryTransaction.setContainerCode(child.getContainerCode());
+                inventoryTransaction.setToLocationCode(child.getLocationCode());
+                inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_CYCLEINTO);
+                inventoryTransaction.setReceiptId(warehousingOrderId);
+                inventoryTransaction.setReceiptDetailId(receiptDetail.getReceiptId());
+                inventoryTransaction.setMaterialCode(child.getMaterialCode());
+                inventoryTransaction.setMaterialName(child.getMaterialName());
+                inventoryTransaction.setMaterialSpec(child.getMaterialSpec());
+                inventoryTransaction.setMaterialUnit(child.getMaterialUnit());
+                inventoryTransaction.setInventoryStatus(child.getInventoryStatus());
+                inventoryTransaction.setQty(child.getCountedQty());
+                inventoryTransaction.setBatch(child.getBatch());
+                inventoryTransaction.setLot(child.getLot());
+                inventoryTransactionService.save(inventoryTransaction);
+
             }
 
+
+
             if (child.getGapQty().compareTo(BigDecimal.ZERO) == -1)
             {
+
+                if (child.getGapQty().abs().compareTo(child.getSystemQty()) > -1)
+                {
+                    inventoryDetailService.removeById(child.getInventoryDetaiId());
+                }
+
+
                 if (outboundOrderId==0)
                 {
                     ShipmentHeader shipmentHeader = new ShipmentHeader();
@@ -1624,7 +1666,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
                 shipmentDetail.setShipmentId(outboundOrderId);
                 shipmentDetail.setShipmentCode(outboundOrderCode);
                 shipmentDetail.setWarehouseCode(taskHeader.getWarehouseCode());
-                shipmentDetail.setCompanyCode(null);
+                shipmentDetail.setCompanyCode(taskHeader.getCompanyCode());
                 shipmentDetail.setMaterialCode(child.getMaterialCode());
                 shipmentDetail.setMaterialName(child.getMaterialName());
                 shipmentDetail.setMaterialSpec(child.getMaterialSpec());
@@ -1636,11 +1678,35 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
                 shipmentDetail.setLot(child.getLot());
                 shipmentDetail.setStatus(QuantityConstant.RECEIPT_HEADER_COMPLETED);
                 shipmentDetailService.save(shipmentDetail);
+
+                InventoryTransaction inventoryTransaction=new InventoryTransaction();
+                inventoryTransaction.setWarehouseCode(taskHeader.getWarehouseCode());
+                inventoryTransaction.setCompanyCode(taskHeader.getCompanyCode());
+                inventoryTransaction.setContainerCode(child.getContainerCode());
+                inventoryTransaction.setFromLocationCode(child.getLocationCode());
+                inventoryTransaction.setType(QuantityConstant.INVENTORY_TRANSACTION_CYCLEOUT);
+                inventoryTransaction.setShipmentId(outboundOrderId);
+                inventoryTransaction.setShipmentDetailId(shipmentDetail.getId());
+                inventoryTransaction.setMaterialCode(child.getMaterialCode());
+                inventoryTransaction.setMaterialName(child.getMaterialName());
+                inventoryTransaction.setMaterialSpec(child.getMaterialSpec());
+                inventoryTransaction.setMaterialUnit(child.getMaterialUnit());
+                inventoryTransaction.setInventoryStatus(child.getInventoryStatus());
+                inventoryTransaction.setQty(child.getCountedQty());
+                inventoryTransaction.setBatch(child.getBatch());
+                inventoryTransaction.setLot(child.getLot());
+                inventoryTransactionService.save(inventoryTransaction);
             }
             cycleCountDetailChildService.updateById(child);
         }
 
 
+        if (inventoryHeader.getTotalQty().compareTo(BigDecimal.ZERO)<1)
+        {
+            inventoryHeaderService.removeById(inventoryHeader);
+        }
+
+        inventoryHeaderService.updateById(inventoryHeader);
 
         //4.完成当前任务
         if (!taskHeaderService.saveOrUpdate(taskHeader)) {
@@ -1658,6 +1724,7 @@ public class TaskHeaderServiceImpl extends ServiceImpl<TaskHeaderMapper, TaskHea
         //释放库位
         locationService.updateStatus(cycleCountDetail.getLocationCode(),
                 QuantityConstant.STATUS_LOCATION_EMPTY, taskHeader.getWarehouseCode());
+
         return Result.OK("完成盘点任务成功");
     }