|  |  | @ -22,10 +22,12 @@ import com.glxp.api.res.basic.UdiRelevanceResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.inout.IoOrderResponse; |  |  |  | import com.glxp.api.res.inout.IoOrderResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.inv.BindInvSpaceRequest; |  |  |  | import com.glxp.api.res.inv.BindInvSpaceRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.inv.InvPlaceDetailResponse; |  |  |  | import com.glxp.api.res.inv.InvPlaceDetailResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.service.auth.CustomerService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.basic.UdiRelevanceService; |  |  |  | import com.glxp.api.service.basic.UdiRelevanceService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inv.InvPlaceOrderService; |  |  |  | import com.glxp.api.service.inv.InvPlaceOrderService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inv.InvPlaceService; |  |  |  | import com.glxp.api.service.inv.InvPlaceService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.BeanCopyUtils; |  |  |  | import com.glxp.api.util.BeanCopyUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.util.GennerOrderUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.OrderNoTypeBean; |  |  |  | import com.glxp.api.util.OrderNoTypeBean; | 
			
		
	
		
		
			
				
					
					|  |  |  | import io.swagger.models.auth.In; |  |  |  | import io.swagger.models.auth.In; | 
			
		
	
		
		
			
				
					
					|  |  |  | import lombok.extern.slf4j.Slf4j; |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
	
		
		
			
				
					|  |  | @ -62,7 +64,10 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |     private InvPlaceOrderDetailDao invPlaceOrderDetailDao; |  |  |  |     private InvPlaceOrderDetailDao invPlaceOrderDetailDao; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     private UdiRelevanceService udiRelevanceService; |  |  |  |     private UdiRelevanceService udiRelevanceService; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |     @Resource | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private CustomerService customerService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private GennerOrderUtils gennerOrderUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Override |  |  |  |     @Override | 
			
		
	
	
		
		
			
				
					|  |  | @ -82,62 +87,62 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         //查询仓库的部门ID
 |  |  |  |         //查询仓库的部门ID
 | 
			
		
	
		
		
			
				
					
					|  |  |  | //        String deptCode = invWarehouseDao.selectParentIdByCode(bindInvSpaceRequest.getInvCode());
 |  |  |  | //        String deptCode = invWarehouseDao.selectParentIdByCode(bindInvSpaceRequest.getInvCode());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseDao.filterGroupInvSubAndcode(bindInvSpaceRequest.getInvCode()); |  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseDao.filterGroupInvSubAndcode(bindInvSpaceRequest.getInvCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList=new ArrayList<>(); |  |  |  |         List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList = new ArrayList<>(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { |  |  |  |         if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             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 (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { |  |  |  |                 for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     //拆解库存表
 |  |  |  |                     //拆解库存表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     QueryWrapper<InvPreInProductDetailEntity> ew=new QueryWrapper<>(); |  |  |  |                     QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     InvPreInProductDetailEntity invPreInProductDetailEntity=new InvPreInProductDetailEntity(); |  |  |  |                     InvPreInProductDetailEntity invPreInProductDetailEntity = new InvPreInProductDetailEntity(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     if(bindInvSpaceRequest.getType()==3){ |  |  |  |                     if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode()); |  |  |  |                         ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         ew.last("limit 1"); |  |  |  |                         ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity=invPreInProductDetailDao.selectOne(ew); |  |  |  |                         invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     }else{ |  |  |  |                     } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.and(o-> o.isNull("invSpaceCode").or().eq("invSpaceCode","")); |  |  |  |                         ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", "")); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.gt("inCount",0); |  |  |  |                         ew.gt("inCount", 0); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         ew.last("limit 1"); |  |  |  |                         ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity=invPreInProductDetailDao.selectOne(ew); |  |  |  |                         invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if(invPreInProductDetailEntity.getInCount()>0){ |  |  |  |                     if (invPreInProductDetailEntity.getInCount() > 0) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         String nameCode=invPreInProductDetailEntity.getNameCode(); |  |  |  |                         String nameCode = invPreInProductDetailEntity.getNameCode(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         int reCount=getActCount(nameCode); |  |  |  |                         int reCount = getActCount(nameCode); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount()-1); |  |  |  |                         invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount() - 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount()-1); |  |  |  |                         invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount() - 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-reCount); |  |  |  |                         invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount() - reCount); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailDao.updateById(invPreInProductDetailEntity); |  |  |  |                         invPreInProductDetailDao.updateById(invPreInProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.clear(); |  |  |  |                         ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         if(bindInvSpaceRequest.getType()==3){ |  |  |  |                         if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             ew.eq("invSpaceCode",bindInvSpaceRequest.getChangeSpaceCode()); |  |  |  |                             ew.eq("invSpaceCode", bindInvSpaceRequest.getChangeSpaceCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         }else{ |  |  |  |                         } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             ew.eq("invSpaceCode",invPlaceOrderDetailEntity.getInvSpaceCode()); |  |  |  |                             ew.eq("invSpaceCode", invPlaceOrderDetailEntity.getInvSpaceCode()); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         InvPreInProductDetailEntity invPreInProductDetailEntity1=invPreInProductDetailDao.selectOne(ew); |  |  |  |                         InvPreInProductDetailEntity invPreInProductDetailEntity1 = invPreInProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         if(invPreInProductDetailEntity1!=null){ |  |  |  |                         if (invPreInProductDetailEntity1 != null) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount()+1); |  |  |  |                             invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount() + 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount()+1); |  |  |  |                             invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount() + 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount()+reCount); |  |  |  |                             invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount() + reCount); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailDao.updateById(invPreInProductDetailEntity1); |  |  |  |                             invPreInProductDetailDao.updateById(invPreInProductDetailEntity1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         }else{ |  |  |  |                         } else { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setId(null); |  |  |  |                             invPreInProductDetailEntity.setId(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setInCount(1); |  |  |  |                             invPreInProductDetailEntity.setInCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setCount(1); |  |  |  |                             invPreInProductDetailEntity.setCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setReCount(reCount); |  |  |  |                             invPreInProductDetailEntity.setReCount(reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setOutCount(0); |  |  |  |                             invPreInProductDetailEntity.setOutCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |                            if (bindInvSpaceRequest.getType()==3){ |  |  |  |                             if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getChangeSpaceCode()); |  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getChangeSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                            }else{ |  |  |  |                             } else { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode()); |  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailDao.insert(invPreInProductDetailEntity); |  |  |  |                             invPreInProductDetailDao.insert(invPreInProductDetailEntity); | 
			
		
	
	
		
		
			
				
					|  |  | @ -149,58 +154,58 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) { |  |  |  |         } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |            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 (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { |  |  |  |                 for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     //拆解库存表
 |  |  |  |                     //拆解库存表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     InvPreProductDetailEntity invPreInProductDetailEntity=new InvPreProductDetailEntity(); |  |  |  |                     InvPreProductDetailEntity invPreInProductDetailEntity = new InvPreProductDetailEntity(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     QueryWrapper<InvPreProductDetailEntity> ew=new QueryWrapper<>(); |  |  |  |                     QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     if(bindInvSpaceRequest.getType()==3){ |  |  |  |                     if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode()); |  |  |  |                         ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         ew.last("limit 1"); |  |  |  |                         ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity=invPreProductDetailDao.selectOne(ew); |  |  |  |                         invPreInProductDetailEntity = invPreProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     }else{ |  |  |  |                     } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.and(o-> o.isNull("invSpaceCode").or().eq("invSpaceCode","")); |  |  |  |                         ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", "")); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.gt("inCount",0); |  |  |  |                         ew.gt("inCount", 0); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         ew.last("limit 1"); |  |  |  |                         ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity=invPreProductDetailDao.selectOne(ew); |  |  |  |                         invPreInProductDetailEntity = invPreProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if(invPreInProductDetailEntity.getInCount()>0){ |  |  |  |                     if (invPreInProductDetailEntity.getInCount() > 0) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         String nameCode=invPreInProductDetailEntity.getNameCode(); |  |  |  |                         String nameCode = invPreInProductDetailEntity.getNameCode(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         int reCount=getActCount(nameCode); |  |  |  |                         int reCount = getActCount(nameCode); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount()-1); |  |  |  |                         invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount() - 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount()-1); |  |  |  |                         invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount() - 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-reCount); |  |  |  |                         invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount() - reCount); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         invPreProductDetailDao.updateById(invPreInProductDetailEntity); |  |  |  |                         invPreProductDetailDao.updateById(invPreInProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.clear(); |  |  |  |                         ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         if(bindInvSpaceRequest.getType()==3){ |  |  |  |                         if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             ew.eq("invSpaceCode",bindInvSpaceRequest.getChangeSpaceCode()); |  |  |  |                             ew.eq("invSpaceCode", bindInvSpaceRequest.getChangeSpaceCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         }else{ |  |  |  |                         } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             ew.eq("invSpaceCode",invPlaceOrderDetailEntity.getInvSpaceCode()); |  |  |  |                             ew.eq("invSpaceCode", invPlaceOrderDetailEntity.getInvSpaceCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         InvPreProductDetailEntity invPreInProductDetailEntity1=invPreProductDetailDao.selectOne(ew); |  |  |  |                         InvPreProductDetailEntity invPreInProductDetailEntity1 = invPreProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         if(invPreInProductDetailEntity1!=null){ |  |  |  |                         if (invPreInProductDetailEntity1 != null) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount()+1); |  |  |  |                             invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount() + 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount()+1); |  |  |  |                             invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount() + 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount()+reCount); |  |  |  |                             invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount() + reCount); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                             invPreProductDetailDao.updateById(invPreInProductDetailEntity1); |  |  |  |                             invPreProductDetailDao.updateById(invPreInProductDetailEntity1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         }else{ |  |  |  |                         } else { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setId(null); |  |  |  |                             invPreInProductDetailEntity.setId(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setInCount(1); |  |  |  |                             invPreInProductDetailEntity.setInCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setCount(1); |  |  |  |                             invPreInProductDetailEntity.setCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setOutCount(0); |  |  |  |                             invPreInProductDetailEntity.setOutCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setReCount(reCount); |  |  |  |                             invPreInProductDetailEntity.setReCount(reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             if (bindInvSpaceRequest.getType()==3){ |  |  |  |                             if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getChangeSpaceCode()); |  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getChangeSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             }else{ |  |  |  |                             } else { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode()); |  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreProductDetailDao.insert(invPreInProductDetailEntity); |  |  |  |                             invPreProductDetailDao.insert(invPreInProductDetailEntity); | 
			
		
	
	
		
		
			
				
					|  |  | @ -210,57 +215,57 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |            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 (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { |  |  |  |                 for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     //拆解库存表
 |  |  |  |                     //拆解库存表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     InvProductDetailEntity invPreInProductDetailEntity=new InvProductDetailEntity(); |  |  |  |                     InvProductDetailEntity invPreInProductDetailEntity = new InvProductDetailEntity(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     QueryWrapper<InvProductDetailEntity> ew=new QueryWrapper<>(); |  |  |  |                     QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     if(bindInvSpaceRequest.getType()==3){ |  |  |  |                     if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode()); |  |  |  |                         ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         ew.last("limit 1"); |  |  |  |                         ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity=invProductDetailDao.selectOne(ew); |  |  |  |                         invPreInProductDetailEntity = invProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     }else{ |  |  |  |                     } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.and(o-> o.isNull("invSpaceCode").or().eq("invSpaceCode","")); |  |  |  |                         ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", "")); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.gt("inCount",0); |  |  |  |                         ew.gt("inCount", 0); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         ew.last("limit 1"); |  |  |  |                         ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity=invProductDetailDao.selectOne(ew); |  |  |  |                         invPreInProductDetailEntity = invProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     if(invPreInProductDetailEntity.getInCount()>0){ |  |  |  |                     if (invPreInProductDetailEntity.getInCount() > 0) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         String nameCode=invPreInProductDetailEntity.getNameCode(); |  |  |  |                         String nameCode = invPreInProductDetailEntity.getNameCode(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         int reCount=getActCount(nameCode); |  |  |  |                         int reCount = getActCount(nameCode); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount()-1); |  |  |  |                         invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount() - 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount()-1); |  |  |  |                         invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount() - 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount()-reCount); |  |  |  |                         invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount() - reCount); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                         invProductDetailDao.updateById(invPreInProductDetailEntity); |  |  |  |                         invProductDetailDao.updateById(invPreInProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.clear(); |  |  |  |                         ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         if(bindInvSpaceRequest.getType()==3){ |  |  |  |                         if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             ew.eq("invSpaceCode",bindInvSpaceRequest.getChangeSpaceCode()); |  |  |  |                             ew.eq("invSpaceCode", bindInvSpaceRequest.getChangeSpaceCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         }else{ |  |  |  |                         } else { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             ew.eq("invSpaceCode",invPlaceOrderDetailEntity.getInvSpaceCode()); |  |  |  |                             ew.eq("invSpaceCode", invPlaceOrderDetailEntity.getInvSpaceCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         InvProductDetailEntity invPreInProductDetailEntity1=invProductDetailDao.selectOne(ew); |  |  |  |                         InvProductDetailEntity invPreInProductDetailEntity1 = invProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         if(invPreInProductDetailEntity1!=null){ |  |  |  |                         if (invPreInProductDetailEntity1 != null) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount()+1); |  |  |  |                             invPreInProductDetailEntity1.setCount(invPreInProductDetailEntity1.getCount() + 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount()+1); |  |  |  |                             invPreInProductDetailEntity1.setInCount(invPreInProductDetailEntity1.getInCount() + 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount()+reCount); |  |  |  |                             invPreInProductDetailEntity1.setReCount(invPreInProductDetailEntity1.getReCount() + reCount); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                             invProductDetailDao.updateById(invPreInProductDetailEntity1); |  |  |  |                             invProductDetailDao.updateById(invPreInProductDetailEntity1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         }else{ |  |  |  |                         } else { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setId(null); |  |  |  |                             invPreInProductDetailEntity.setId(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setInCount(1); |  |  |  |                             invPreInProductDetailEntity.setInCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setCount(1); |  |  |  |                             invPreInProductDetailEntity.setCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setOutCount(0); |  |  |  |                             invPreInProductDetailEntity.setOutCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setReCount(reCount); |  |  |  |                             invPreInProductDetailEntity.setReCount(reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             if (bindInvSpaceRequest.getType()==3){ |  |  |  |                             if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getChangeSpaceCode()); |  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getChangeSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             }else{ |  |  |  |                             } else { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode()); |  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             } |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invProductDetailDao.insert(invPreInProductDetailEntity); |  |  |  |                             invProductDetailDao.insert(invPreInProductDetailEntity); | 
			
		
	
	
		
		
			
				
					|  |  | @ -271,12 +276,12 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         int total = invPlaceOrderDetailEntityList.stream().mapToInt(InvPlaceOrderDetailEntity::getCount).sum(); |  |  |  |         int total = invPlaceOrderDetailEntityList.stream().mapToInt(InvPlaceOrderDetailEntity::getCount).sum(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         QueryWrapper<InvPlaceOrderEntity> ew=new QueryWrapper<>(); |  |  |  |         QueryWrapper<InvPlaceOrderEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         ew.eq("recordId",bindInvSpaceRequest.getOrderId()); |  |  |  |         ew.eq("recordId", bindInvSpaceRequest.getOrderId()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         InvPlaceOrderEntity invPlaceOrderEntity=new InvPlaceOrderEntity(); |  |  |  |         InvPlaceOrderEntity invPlaceOrderEntity = new InvPlaceOrderEntity(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         invPlaceOrderEntity.setRecordId(bindInvSpaceRequest.getOrderId()); |  |  |  |         invPlaceOrderEntity.setRecordId(bindInvSpaceRequest.getOrderId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         invPlaceOrderEntity.setCount(total); |  |  |  |         invPlaceOrderEntity.setCount(total); | 
			
		
	
		
		
			
				
					
					|  |  |  |         invPlaceOrderDao.update(invPlaceOrderEntity,ew); |  |  |  |         invPlaceOrderDao.update(invPlaceOrderEntity, ew); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | //        if (CollUtil.isNotEmpty(list)) {
 |  |  |  | //        if (CollUtil.isNotEmpty(list)) {
 | 
			
		
	
		
		
			
				
					
					|  |  |  | //            List<Integer> ids = list.stream().map(InvProductDetailEntity::getId).collect(Collectors.toList());
 |  |  |  | //            List<Integer> ids = list.stream().map(InvProductDetailEntity::getId).collect(Collectors.toList());
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -314,42 +319,42 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         //查询仓库的部门ID
 |  |  |  |         //查询仓库的部门ID
 | 
			
		
	
		
		
			
				
					
					|  |  |  | //        String deptCode = invWarehouseDao.selectParentIdByCode(bindInvSpaceRequest.getInvCode());
 |  |  |  | //        String deptCode = invWarehouseDao.selectParentIdByCode(bindInvSpaceRequest.getInvCode());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseDao.filterGroupInvSubAndcode(bindInvSpaceRequest.getInvCode()); |  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseDao.filterGroupInvSubAndcode(bindInvSpaceRequest.getInvCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList=new ArrayList<>(); |  |  |  |         List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList = new ArrayList<>(); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { |  |  |  |         if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId())); |  |  |  |             invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId())); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             QueryWrapper<InvPreInProductDetailEntity> ew=new QueryWrapper<>(); |  |  |  |             QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             ew.eq("orderId",bindInvSpaceRequest.getOId()); |  |  |  |             ew.eq("orderId", bindInvSpaceRequest.getOId()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             InvPreInProductDetailEntity invPreInProductDetailEntity=new InvPreInProductDetailEntity(); |  |  |  |             InvPreInProductDetailEntity invPreInProductDetailEntity = new InvPreInProductDetailEntity(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode()); |  |  |  |             invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             invPreInProductDetailDao.update(invPreInProductDetailEntity,ew); |  |  |  |             invPreInProductDetailDao.update(invPreInProductDetailEntity, ew); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) { |  |  |  |         } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId())); |  |  |  |             invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId())); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             QueryWrapper<InvPreProductDetailEntity> ew=new QueryWrapper<>(); |  |  |  |             QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             ew.eq("orderId",bindInvSpaceRequest.getOId()); |  |  |  |             ew.eq("orderId", bindInvSpaceRequest.getOId()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             InvPreProductDetailEntity invPreProductDetailEntity=new InvPreProductDetailEntity(); |  |  |  |             InvPreProductDetailEntity invPreProductDetailEntity = new InvPreProductDetailEntity(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             invPreProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode()); |  |  |  |             invPreProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             invPreProductDetailDao.update(invPreProductDetailEntity,ew); |  |  |  |             invPreProductDetailDao.update(invPreProductDetailEntity, ew); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             invPlaceOrderDetailEntityList=invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId",bindInvSpaceRequest.getOrderId())); |  |  |  |             invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId())); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             QueryWrapper<InvProductDetailEntity> ew=new QueryWrapper<>(); |  |  |  |             QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             ew.eq("orderId",bindInvSpaceRequest.getOId()); |  |  |  |             ew.eq("orderId", bindInvSpaceRequest.getOId()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             InvProductDetailEntity invProductDetailEntity=new InvProductDetailEntity(); |  |  |  |             InvProductDetailEntity invProductDetailEntity = new InvProductDetailEntity(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             invProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode()); |  |  |  |             invProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             invProductDetailDao.update(invProductDetailEntity,ew); |  |  |  |             invProductDetailDao.update(invProductDetailEntity, ew); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         int total = invPlaceOrderDetailEntityList.stream().mapToInt(InvPlaceOrderDetailEntity::getCount).sum(); |  |  |  |         int total = invPlaceOrderDetailEntityList.stream().mapToInt(InvPlaceOrderDetailEntity::getCount).sum(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         QueryWrapper<InvPlaceOrderEntity> ew=new QueryWrapper<>(); |  |  |  |         QueryWrapper<InvPlaceOrderEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         ew.eq("recordId",bindInvSpaceRequest.getOrderId()); |  |  |  |         ew.eq("recordId", bindInvSpaceRequest.getOrderId()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         InvPlaceOrderEntity invPlaceOrderEntity=new InvPlaceOrderEntity(); |  |  |  |         InvPlaceOrderEntity invPlaceOrderEntity = new InvPlaceOrderEntity(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         invPlaceOrderEntity.setRecordId(bindInvSpaceRequest.getOrderId()); |  |  |  |         invPlaceOrderEntity.setRecordId(bindInvSpaceRequest.getOrderId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         invPlaceOrderEntity.setCount(total); |  |  |  |         invPlaceOrderEntity.setCount(total); | 
			
		
	
		
		
			
				
					
					|  |  |  |         invPlaceOrderDao.update(invPlaceOrderEntity,ew); |  |  |  |         invPlaceOrderDao.update(invPlaceOrderEntity, ew); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         return ResultVOUtils.success(); |  |  |  |         return ResultVOUtils.success(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -480,84 +485,161 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Override |  |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |     public String checkCount(BindInvSpaceRequest bindInvSpaceRequest) { |  |  |  |     public String checkCount(BindInvSpaceRequest bindInvSpaceRequest) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseDao.selectOne(new QueryWrapper<InvWarehouseEntity>().eq("code", bindInvSpaceRequest.getInvCode())); |  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseDao.selectOne(new QueryWrapper<InvWarehouseEntity>().eq("code", bindInvSpaceRequest.getInvCode())); | 
			
		
	
		
		
			
				
					
					|  |  |  |         Integer count=0; |  |  |  |         Integer count = 0; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { |  |  |  |         if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(bindInvSpaceRequest.getType()==3){ |  |  |  |             if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 QueryWrapper<InvPreInProductDetailEntity> ew=new QueryWrapper<>(); |  |  |  |                 QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("code",bindInvSpaceRequest.getCode()); |  |  |  |                 ew.eq("code", bindInvSpaceRequest.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode()); |  |  |  |                 ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 InvPreInProductDetailEntity invPreInProductDetailEntity=invPreInProductDetailDao.selectOne(ew); |  |  |  |                 InvPreInProductDetailEntity invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 count=invPreInProductDetailEntity.getInCount(); |  |  |  |                 count = invPreInProductDetailEntity.getInCount(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             }else{ |  |  |  |             } else { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 count = invPreInProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); |  |  |  |                 count = invPreInProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(count==null || count<=0){ |  |  |  |             if (count == null || count <= 0) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 return "该产品库存不足!"; |  |  |  |                 return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())){ |  |  |  |             if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 QueryWrapper ew=new QueryWrapper(); |  |  |  |                 QueryWrapper ew = new QueryWrapper(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("recordId",bindInvSpaceRequest.getOrderId()); |  |  |  |                 ew.eq("recordId", bindInvSpaceRequest.getOrderId()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("code",bindInvSpaceRequest.getCode()); |  |  |  |                 ew.eq("code", bindInvSpaceRequest.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 InvPlaceOrderDetailEntity invPlaceOrderDetailEntity =invPlaceOrderDetailDao.selectOne(ew); |  |  |  |                 InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 if(invPlaceOrderDetailEntity==null){ |  |  |  |                 if (invPlaceOrderDetailEntity == null) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     invPlaceOrderDetailEntity=new InvPlaceOrderDetailEntity(); |  |  |  |                     invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     invPlaceOrderDetailEntity.setCount(0); |  |  |  |                     invPlaceOrderDetailEntity.setCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if(invPlaceOrderDetailEntity.getCount()>=count){ |  |  |  |                 if (invPlaceOrderDetailEntity.getCount() >= count) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     return "该产品库存不足!"; |  |  |  |                     return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) { |  |  |  |         } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(bindInvSpaceRequest.getType()==3){ |  |  |  |             if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 QueryWrapper<InvPreProductDetailEntity> ew=new QueryWrapper<>(); |  |  |  |                 QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("code",bindInvSpaceRequest.getCode()); |  |  |  |                 ew.eq("code", bindInvSpaceRequest.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode()); |  |  |  |                 ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 InvPreProductDetailEntity invPreProductDetailEntity=invPreProductDetailDao.selectOne(ew); |  |  |  |                 InvPreProductDetailEntity invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 count=invPreProductDetailEntity.getInCount(); |  |  |  |                 count = invPreProductDetailEntity.getInCount(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             }else{ |  |  |  |             } else { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 count = invPreProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); |  |  |  |                 count = invPreProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(count==null || count<=0){ |  |  |  |             if (count == null || count <= 0) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 return "该产品库存不足!"; |  |  |  |                 return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())){ |  |  |  |             if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 QueryWrapper ew=new QueryWrapper(); |  |  |  |                 QueryWrapper ew = new QueryWrapper(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("recordId",bindInvSpaceRequest.getOrderId()); |  |  |  |                 ew.eq("recordId", bindInvSpaceRequest.getOrderId()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("code",bindInvSpaceRequest.getCode()); |  |  |  |                 ew.eq("code", bindInvSpaceRequest.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 InvPlaceOrderDetailEntity invPlaceOrderDetailEntity =invPlaceOrderDetailDao.selectOne(ew); |  |  |  |                 InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 if(invPlaceOrderDetailEntity==null){ |  |  |  |                 if (invPlaceOrderDetailEntity == null) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     invPlaceOrderDetailEntity=new InvPlaceOrderDetailEntity(); |  |  |  |                     invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity(); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     invPlaceOrderDetailEntity.setCount(0); |  |  |  |                     invPlaceOrderDetailEntity.setCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if(invPlaceOrderDetailEntity.getCount()>=count){ |  |  |  |                 if (invPlaceOrderDetailEntity.getCount() >= count) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     return "该产品库存不足!"; |  |  |  |                     return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_NORMAL){ |  |  |  |         } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_NORMAL) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             if(bindInvSpaceRequest.getType()==3){ |  |  |  |             if (bindInvSpaceRequest.getType() == 3) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 QueryWrapper<InvProductDetailEntity> ew=new QueryWrapper<>(); |  |  |  |                 QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("code",bindInvSpaceRequest.getCode()); |  |  |  |                 ew.eq("code", bindInvSpaceRequest.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode()); |  |  |  |                 ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 InvProductDetailEntity invProductDetailEntity=invProductDetailDao.selectOne(ew); |  |  |  |                 InvProductDetailEntity invProductDetailEntity = invProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 count=invProductDetailEntity.getInCount(); |  |  |  |                 count = invProductDetailEntity.getInCount(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             }else{ |  |  |  |             } else { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 count = invProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); |  |  |  |                 count = invProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(count==null || count<=0){ |  |  |  |             if (count == null || count <= 0) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 QueryWrapper ew = new QueryWrapper(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew.eq("recordId", bindInvSpaceRequest.getOrderId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew.eq("code", bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (invPlaceOrderDetailEntity == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPlaceOrderDetailEntity.setCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (invPlaceOrderDetailEntity.getCount() >= count) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public String checkOutCount(BindInvSpaceRequest bindInvSpaceRequest) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseDao.selectOne(new QueryWrapper<InvWarehouseEntity>().eq("code", bindInvSpaceRequest.getInvCode())); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ew.eq("code", bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ew.select("count"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             InvPreInProductDetailEntity invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (invPreInProductDetailEntity.getCount() <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return "该产品没存在该货架上!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 QueryWrapper ew1 = new QueryWrapper(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew1.eq("recordId", bindInvSpaceRequest.getOrderId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew1.eq("code", bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (invPlaceOrderDetailEntity == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPlaceOrderDetailEntity.setCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (invPlaceOrderDetailEntity.getCount() >= invPreInProductDetailEntity.getCount()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ew.eq("code", bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ew.select("count"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             InvPreProductDetailEntity invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (invPreProductDetailEntity.getCount() <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return "该产品没存在该货架上!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 QueryWrapper ew1 = new QueryWrapper(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew1.eq("recordId", bindInvSpaceRequest.getOrderId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew1.eq("code", bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (invPlaceOrderDetailEntity == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPlaceOrderDetailEntity.setCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (invPlaceOrderDetailEntity.getCount() >= invPreProductDetailEntity.getCount()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     return "该产品库存不足!"; |  |  |  |                     return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())){ |  |  |  |             } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 QueryWrapper ew=new QueryWrapper(); |  |  |  |         } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_NORMAL) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("recordId",bindInvSpaceRequest.getOrderId()); |  |  |  |             QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 ew.eq("code",bindInvSpaceRequest.getCode()); |  |  |  |             ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 InvPlaceOrderDetailEntity invPlaceOrderDetailEntity =invPlaceOrderDetailDao.selectOne(ew); |  |  |  |             ew.eq("code", bindInvSpaceRequest.getCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 if(invPlaceOrderDetailEntity==null){ |  |  |  |             ew.select("count"); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     invPlaceOrderDetailEntity=new InvPlaceOrderDetailEntity(); |  |  |  |             ew.last("limit 1"); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             InvProductDetailEntity invProductDetailEntity = invProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (invProductDetailEntity.getCount() <= 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 return "该产品没存在该货架上!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (StrUtil.isNotBlank(bindInvSpaceRequest.getOrderId())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 QueryWrapper ew1 = new QueryWrapper(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew1.eq("recordId", bindInvSpaceRequest.getOrderId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew1.eq("code", bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = invPlaceOrderDetailDao.selectOne(ew1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (invPlaceOrderDetailEntity == null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     invPlaceOrderDetailEntity.setCount(0); |  |  |  |                     invPlaceOrderDetailEntity.setCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if(invPlaceOrderDetailEntity.getCount()>=count){ |  |  |  |                 if (invPlaceOrderDetailEntity.getCount() >= invProductDetailEntity.getCount()) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     return "该产品库存不足!"; |  |  |  |                     return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
	
		
		
			
				
					|  |  | @ -565,11 +647,13 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return ""; |  |  |  |         return ""; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public int getActCount(String nameCode) { |  |  |  |     public int getActCount(String nameCode) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(nameCode); |  |  |  |         UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByNameCode(nameCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |         int count = getActCount(udiRelevanceResponse); |  |  |  |         int count = getActCount(udiRelevanceResponse); | 
			
		
	
		
		
			
				
					
					|  |  |  |         return count; |  |  |  |         return count; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     public int getActCount(UdiRelevanceResponse udiRelevanceResponse) { |  |  |  |     public int getActCount(UdiRelevanceResponse udiRelevanceResponse) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         int actCount; |  |  |  |         int actCount; | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (!udiRelevanceResponse.getUseDy() && (udiRelevanceResponse.getDiType() == null || udiRelevanceResponse.getDiType() != 2)) { |  |  |  |         if (!udiRelevanceResponse.getUseDy() && (udiRelevanceResponse.getDiType() == null || udiRelevanceResponse.getDiType() != 2)) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -590,4 +674,352 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         return actCount; |  |  |  |         return actCount; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public BaseResponse unbindInvOrderSpace(BindInvSpaceRequest bindInvSpaceRequest) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //查询仓库的部门ID
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        String deptCode = invWarehouseDao.selectParentIdByCode(bindInvSpaceRequest.getInvCode());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         InvWarehouseEntity invWarehouseEntity = invWarehouseDao.filterGroupInvSubAndcode(bindInvSpaceRequest.getInvCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         List<InvPlaceOrderDetailEntity> invPlaceOrderDetailEntityList = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         int total=0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (bindInvSpaceRequest.getOutCount() > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId())); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         //去掉库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         InvPreInProductDetailEntity invPreInProductDetailEntity = new InvPreInProductDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.gt("inCount", 0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         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() - reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invPreInProductDetailDao.updateById(invPreInProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             //如果库存为空就删了该数据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (invPreInProductDetailEntity != null && invPreInProductDetailEntity.getInCount() == 0 && invPreInProductDetailEntity.getOutCount() == 0 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     && invPreInProductDetailEntity.getCount() == 0 && invPreInProductDetailEntity.getReCount() == 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailDao.deleteById(invPreInProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             //如果有存在数据就加没有就新建
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", "")); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (invPreInProductDetailEntity != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 nameCode = invPreInProductDetailEntity.getNameCode(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 reCount = getActCount(nameCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailEntity.setInCount(invPreInProductDetailEntity.getInCount() + 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailEntity.setCount(invPreInProductDetailEntity.getCount() + 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailEntity.setReCount(invPreInProductDetailEntity.getReCount() + reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailDao.updateById(invPreInProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailEntity = invPreInProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailEntity.setId(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailEntity.setInvSpaceCode(""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailEntity.setInCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailEntity.setCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailEntity.setReCount(reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailEntity.setOutCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreInProductDetailDao.insert(invPreInProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId())); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         //去掉库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         InvPreProductDetailEntity invPreProductDetailEntity = new InvPreProductDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.gt("inCount", 0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (invPreProductDetailEntity.getInCount() > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             String nameCode = invPlaceOrderDetailEntity.getNameCode(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             int reCount = getActCount(nameCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invPreProductDetailEntity.setInCount(invPreProductDetailEntity.getInCount() - 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invPreProductDetailEntity.setCount(invPreProductDetailEntity.getCount() - 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invPreProductDetailEntity.setReCount(invPreProductDetailEntity.getReCount() - reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invPreProductDetailDao.updateById(invPreProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             //如果库存为空就删了该数据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (invPreProductDetailEntity != null && invPreProductDetailEntity.getInCount() == 0 && invPreProductDetailEntity.getOutCount() == 0 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     && invPreProductDetailEntity.getCount() == 0 && invPreProductDetailEntity.getReCount() == 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailDao.deleteById(invPreProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             //如果有存在数据就加没有就新建
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", "")); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (invPreProductDetailEntity != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 nameCode = invPreProductDetailEntity.getNameCode(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 reCount = getActCount(nameCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailEntity.setInCount(invPreProductDetailEntity.getInCount() + 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailEntity.setCount(invPreProductDetailEntity.getCount() + 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailEntity.setReCount(invPreProductDetailEntity.getReCount() + reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailDao.updateById(invPreProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailEntity = invPreProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailEntity.setId(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailEntity.setInvSpaceCode(""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailEntity.setInCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailEntity.setCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailEntity.setReCount(reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailEntity.setOutCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreProductDetailDao.insert(invPreProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPlaceOrderDetailEntityList = invPlaceOrderDetailDao.selectList(new QueryWrapper<InvPlaceOrderDetailEntity>().eq("recordId", bindInvSpaceRequest.getOrderId())); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 for (InvPlaceOrderDetailEntity invPlaceOrderDetailEntity : invPlaceOrderDetailEntityList) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     for (Integer i = 0; i < invPlaceOrderDetailEntity.getCount(); i++) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         //去掉库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         InvProductDetailEntity invProductDetailEntity = new InvProductDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.gt("inCount", 0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invProductDetailEntity = invProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (invProductDetailEntity.getInCount() > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             String nameCode = invProductDetailEntity.getNameCode(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             int reCount = getActCount(nameCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invProductDetailEntity.setInCount(invProductDetailEntity.getInCount() - 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invProductDetailEntity.setCount(invProductDetailEntity.getCount() - 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invProductDetailEntity.setReCount(invProductDetailEntity.getReCount() - reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invProductDetailDao.updateById(invProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             //如果库存为空就删了该数据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invProductDetailEntity = invProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (invProductDetailEntity != null && invProductDetailEntity.getInCount() == 0 && invProductDetailEntity.getOutCount() == 0 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                     && invProductDetailEntity.getCount() == 0 && invProductDetailEntity.getReCount() == 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailDao.deleteById(invProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             //如果有存在数据就加没有就新建
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.and(o -> o.isNull("invSpaceCode").or().eq("invSpaceCode", "")); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invProductDetailEntity = invProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             if (invProductDetailEntity != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 nameCode = invProductDetailEntity.getNameCode(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 reCount = getActCount(nameCode); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailEntity.setInCount(invProductDetailEntity.getInCount() + 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailEntity.setCount(invProductDetailEntity.getCount() + 1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailEntity.setReCount(invProductDetailEntity.getReCount() + reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailDao.updateById(invProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 ew.eq("code", invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailEntity = invProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailEntity.setId(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailEntity.setInvSpaceCode(""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailEntity.setInCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailEntity.setCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailEntity.setReCount(reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailEntity.setOutCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invProductDetailDao.insert(invProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             total = invPlaceOrderDetailEntityList.stream().mapToInt(InvPlaceOrderDetailEntity::getCount).sum(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 QueryWrapper<InvPreInProductDetailEntity> ew = new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvPreInProductDetailEntity invPreInProductDetailEntity = new InvPreInProductDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPreInProductDetailEntity.setInvSpaceCode(""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 List<InvPreInProductDetailEntity> invProductDetailEntityList=invPreInProductDetailDao.selectList(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 //操作人ID
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 String userId = customerService.getUserIdStr(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 String recordId = gennerOrderUtils.createInvPlaceOrderNo(new OrderNoTypeBean(Constant.INV_PLACE_ORDER, "yyyyMMdd")); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 //插入主表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvPlaceOrderEntity orderEntity = new InvPlaceOrderEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setRecordId(recordId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setType(4); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setCreateUser(userId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setCreateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPlaceOrderDao.insert(orderEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 for (InvPreInProductDetailEntity productDetailEntity : invProductDetailEntityList) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     for (int i=0;i<productDetailEntity.getCount();i++){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         //插入附表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setRecordId(recordId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setBatchNo(productDetailEntity.getBatchNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setRelId(productDetailEntity.getRelId() + ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setNameCode(productDetailEntity.getNameCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setExpireDate(productDetailEntity.getExpireDate()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setProduceDate(productDetailEntity.getProduceDate()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setSupId(productDetailEntity.getSupId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setInvCode(bindInvSpaceRequest.getInvCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setCode(bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setSerialNo(productDetailEntity.getSerialNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailDao.insert(invPlaceOrderDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         total++; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPreInProductDetailDao.update(invPreInProductDetailEntity, ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 bindInvSpaceRequest.setOrderId(recordId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } else if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_ADVANCE) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 QueryWrapper<InvPreProductDetailEntity> ew = new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvPreProductDetailEntity invPreProductDetailEntity = new InvPreProductDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPreProductDetailEntity.setInvSpaceCode(""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 List<InvPreProductDetailEntity> invProductDetailEntityList=invPreProductDetailDao.selectList(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 //操作人ID
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 String userId = customerService.getUserIdStr(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 String recordId = gennerOrderUtils.createInvPlaceOrderNo(new OrderNoTypeBean(Constant.INV_PLACE_ORDER, "yyyyMMdd")); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 //插入主表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvPlaceOrderEntity orderEntity = new InvPlaceOrderEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setRecordId(recordId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setType(4); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setCreateUser(userId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setCreateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPlaceOrderDao.insert(orderEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 for (InvPreProductDetailEntity productDetailEntity : invProductDetailEntityList) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     for (int i=0;i<productDetailEntity.getCount();i++){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         //插入附表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setRecordId(recordId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setBatchNo(productDetailEntity.getBatchNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setRelId(productDetailEntity.getRelId() + ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setNameCode(productDetailEntity.getNameCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setExpireDate(productDetailEntity.getExpireDate()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setProduceDate(productDetailEntity.getProduceDate()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setSupId(productDetailEntity.getSupId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setInvCode(bindInvSpaceRequest.getInvCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setCode(bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setSerialNo(productDetailEntity.getSerialNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailDao.insert(invPlaceOrderDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         total++; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPreProductDetailDao.update(invPreProductDetailEntity, ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 bindInvSpaceRequest.setOrderId(recordId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 QueryWrapper<InvProductDetailEntity> ew = new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew.eq("invSpaceCode", bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvProductDetailEntity invProductDetailEntity = new InvProductDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invProductDetailEntity.setInvSpaceCode(""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 List<InvProductDetailEntity> invProductDetailEntityList=invProductDetailDao.selectList(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 //操作人ID
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 String userId = customerService.getUserIdStr(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 String recordId = gennerOrderUtils.createInvPlaceOrderNo(new OrderNoTypeBean(Constant.INV_PLACE_ORDER, "yyyyMMdd")); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 //插入主表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvPlaceOrderEntity orderEntity = new InvPlaceOrderEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setRecordId(recordId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setType(4); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setCreateUser(userId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setCreateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 orderEntity.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPlaceOrderDao.insert(orderEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 for (InvProductDetailEntity productDetailEntity : invProductDetailEntityList) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     for (int i=0;i<productDetailEntity.getCount();i++){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         //插入附表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         InvPlaceOrderDetailEntity invPlaceOrderDetailEntity = new InvPlaceOrderDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setId(IdUtil.getSnowflakeNextId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setRecordId(recordId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setBatchNo(productDetailEntity.getBatchNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setRelId(productDetailEntity.getRelId() + ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setNameCode(productDetailEntity.getNameCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setExpireDate(productDetailEntity.getExpireDate()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setProduceDate(productDetailEntity.getProduceDate()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setSupId(productDetailEntity.getSupId()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setInvCode(bindInvSpaceRequest.getInvCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setCode(bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setSerialNo(productDetailEntity.getSerialNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailEntity.setCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPlaceOrderDetailDao.insert(invPlaceOrderDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         total++; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invProductDetailDao.update(invProductDetailEntity, ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 bindInvSpaceRequest.setOrderId(recordId); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         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); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return ResultVOUtils.success(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |