|  |  |  | @ -80,12 +80,12 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
			
				
					|  |  |  |  |     @Override | 
			
		
	
		
			
				
					|  |  |  |  |     public BaseResponse bindInvSpace(BindInvSpaceRequest bindInvSpaceRequest) { | 
			
		
	
		
			
				
					|  |  |  |  |         //查询仓库的部门ID
 | 
			
		
	
		
			
				
					|  |  |  |  |         String deptCode = invWarehouseDao.selectParentIdByCode(bindInvSpaceRequest.getInvCode()); | 
			
		
	
		
			
				
					|  |  |  |  | //        String deptCode = invWarehouseDao.selectParentIdByCode(bindInvSpaceRequest.getInvCode());
 | 
			
		
	
		
			
				
					|  |  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseDao.filterGroupInvSubAndcode(bindInvSpaceRequest.getInvCode()); | 
			
		
	
		
			
				
					|  |  |  |  |         List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList=new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         List<InvProductDetailEntity> list = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |         if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { | 
			
		
	
		
			
				
					|  |  |  |  |             List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId())); | 
			
		
	
		
			
				
					|  |  |  |  |             invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId())); | 
			
		
	
		
			
				
					|  |  |  |  |             for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -93,14 +93,16 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
			
				
					|  |  |  |  |                     QueryWrapper<InvPreInProductDetailEntity> ew=new QueryWrapper<>(); | 
			
		
	
		
			
				
					|  |  |  |  |                     ew.eq("code",invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                     ew.and(o-> o.isNull("invSpaceCode").or().eq("invSpaceCode","")); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     ew.gt("inCount",0); | 
			
		
	
		
			
				
					|  |  |  |  |                     ew.last("limit 1"); | 
			
		
	
		
			
				
					|  |  |  |  |                     InvPreInProductDetailEntity invPreInProductDetailEntity=invPreInProductDetailDao.selectOne(ew); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                     if(invPreInProductDetailEntity.getInCount()>0){ | 
			
		
	
		
			
				
					|  |  |  |  |                         String nameCode=invPreInProductDetailEntity.getNameCode(); | 
			
		
	
		
			
				
					|  |  |  |  |                         int reCount=getActCount(nameCode); | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount()-1); | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount()-1); | 
			
		
	
		
			
				
					|  |  |  |  | //                        invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-getActCount(invPlaceOrderDetailEntity.get));
 | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-reCount); | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreInProductDetailDao.updateById(invPreInProductDetailEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -112,11 +114,13 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
			
				
					|  |  |  |  |                         if(invPreInProductDetailEntity1!=null){ | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount()+1); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount()+1); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount()+reCount); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailDao.updateById(invPreInProductDetailEntity1); | 
			
		
	
		
			
				
					|  |  |  |  |                         }else{ | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setId(null); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setInCount(1); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setCount(1); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setReCount(reCount); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setOutCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailDao.insert(invPreInProductDetailEntity); | 
			
		
	
	
		
			
				
					|  |  |  | @ -128,7 +132,7 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |             List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId())); | 
			
		
	
		
			
				
					|  |  |  |  |            invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId())); | 
			
		
	
		
			
				
					|  |  |  |  |             for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -141,9 +145,11 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
			
				
					|  |  |  |  |                     ew.last("limit 1"); | 
			
		
	
		
			
				
					|  |  |  |  |                     InvPreProductDetailEntity invPreInProductDetailEntity=invPreProductDetailDao.selectOne(ew); | 
			
		
	
		
			
				
					|  |  |  |  |                     if(invPreInProductDetailEntity.getInCount()>0){ | 
			
		
	
		
			
				
					|  |  |  |  |                         String nameCode=invPreInProductDetailEntity.getNameCode(); | 
			
		
	
		
			
				
					|  |  |  |  |                         int reCount=getActCount(nameCode); | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount()-1); | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount()-1); | 
			
		
	
		
			
				
					|  |  |  |  | //                        invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-getActCount(invPlaceOrderDetailEntity.get));
 | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-reCount); | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreProductDetailDao.updateById(invPreInProductDetailEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -155,6 +161,7 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
			
				
					|  |  |  |  |                         if(invPreInProductDetailEntity1!=null){ | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount()+1); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount()+1); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount()+reCount); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreProductDetailDao.updateById(invPreInProductDetailEntity1); | 
			
		
	
		
			
				
					|  |  |  |  |                         }else{ | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setId(null); | 
			
		
	
	
		
			
				
					|  |  |  | @ -162,6 +169,7 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setCount(1); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setOutCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setReCount(reCount); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreProductDetailDao.insert(invPreInProductDetailEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
	
		
			
				
					|  |  |  | @ -169,7 +177,7 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |  |             List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId())); | 
			
		
	
		
			
				
					|  |  |  |  |            invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId())); | 
			
		
	
		
			
				
					|  |  |  |  |             for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) { | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -182,9 +190,11 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
			
				
					|  |  |  |  |                     ew.last("limit 1"); | 
			
		
	
		
			
				
					|  |  |  |  |                     InvProductDetailEntity invPreInProductDetailEntity=invProductDetailDao.selectOne(ew); | 
			
		
	
		
			
				
					|  |  |  |  |                     if(invPreInProductDetailEntity.getInCount()>0){ | 
			
		
	
		
			
				
					|  |  |  |  |                         String nameCode=invPreInProductDetailEntity.getNameCode(); | 
			
		
	
		
			
				
					|  |  |  |  |                         int reCount=getActCount(nameCode); | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount()-1); | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount()-1); | 
			
		
	
		
			
				
					|  |  |  |  | //                        invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-getActCount(invPlaceOrderDetailEntity.get));
 | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-reCount); | 
			
		
	
		
			
				
					|  |  |  |  |                         invProductDetailDao.updateById(invPreInProductDetailEntity); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | @ -196,12 +206,14 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
			
				
					|  |  |  |  |                         if(invPreInProductDetailEntity1!=null){ | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount()+1); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount()+1); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount()+reCount); | 
			
		
	
		
			
				
					|  |  |  |  |                             invProductDetailDao.updateById(invPreInProductDetailEntity1); | 
			
		
	
		
			
				
					|  |  |  |  |                         }else{ | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setId(null); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setInCount(1); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setCount(1); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setOutCount(0); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setReCount(reCount); | 
			
		
	
		
			
				
					|  |  |  |  |                             invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                             invProductDetailDao.insert(invPreInProductDetailEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
	
		
			
				
					|  |  |  | @ -210,6 +222,13 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         int total = invPlaceOrderDetailEntityList.stream().mapToInt(InvPlaceOrderDetailEntity::getCount).sum(); | 
			
		
	
		
			
				
					|  |  |  |  |         QueryWrapper<InvPlaceOrderEntity> ew=new QueryWrapper<>(); | 
			
		
	
		
			
				
					|  |  |  |  |         ew.eq("recordId",bindInvSpaceRequest.getOrderId()); | 
			
		
	
		
			
				
					|  |  |  |  |         InvPlaceOrderEntity invPlaceOrderEntity=new InvPlaceOrderEntity(); | 
			
		
	
		
			
				
					|  |  |  |  |         invPlaceOrderEntity.setRecordId(bindInvSpaceRequest.getOrderId()); | 
			
		
	
		
			
				
					|  |  |  |  |         invPlaceOrderEntity.setCount(total); | 
			
		
	
		
			
				
					|  |  |  |  |         invPlaceOrderDao.update(invPlaceOrderEntity,ew); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | //        if (CollUtil.isNotEmpty(list)) {
 | 
			
		
	
		
			
				
					|  |  |  |  | //            List<Integer> ids = list.stream().map(InvProductDetailEntity::getId).collect(Collectors.toList());
 | 
			
		
	
	
		
			
				
					|  |  |  | 
 |