|  |  | @ -83,7 +83,6 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  | //        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) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -91,11 +90,20 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 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(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if(bindInvSpaceRequest.getType()==3){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         ew.last("limit 1"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPreInProductDetailEntity=invPreInProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     }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 invPreInProductDetailEntity=invPreInProductDetailDao.selectOne(ew); |  |  |  |                         invPreInProductDetailEntity=invPreInProductDetailDao.selectOne(ew); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if(invPreInProductDetailEntity.getInCount()>0){ |  |  |  |                     if(invPreInProductDetailEntity.getInCount()>0){ | 
			
		
	
		
		
			
				
					
					|  |  |  |                         String nameCode=invPreInProductDetailEntity.getNameCode(); |  |  |  |                         String nameCode=invPreInProductDetailEntity.getNameCode(); | 
			
		
	
	
		
		
			
				
					|  |  | @ -108,7 +116,12 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.clear(); |  |  |  |                         ew.clear(); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); |  |  |  |                         ew.eq("code",invPlaceOrderDetailEntity.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if(bindInvSpaceRequest.getType()==3){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             ew.eq("invSpaceCode",bindInvSpaceRequest.getChangeSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         }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){ | 
			
		
	
	
		
		
			
				
					|  |  | @ -122,7 +135,11 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setCount(1); |  |  |  |                             invPreInProductDetailEntity.setCount(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setReCount(reCount); |  |  |  |                             invPreInProductDetailEntity.setReCount(reCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailEntity.setOutCount(0); |  |  |  |                             invPreInProductDetailEntity.setOutCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                            if (bindInvSpaceRequest.getType()==3){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                invPreInProductDetailEntity.setInvSpaceCode(bindInvSpaceRequest.getChangeSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                            }else{ | 
			
		
	
		
		
			
				
					
					|  |  |  |                                invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode()); |  |  |  |                                invPreInProductDetailEntity.setInvSpaceCode(invPlaceOrderDetailEntity.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                            } | 
			
		
	
		
		
			
				
					
					|  |  |  |                             invPreInProductDetailDao.insert(invPreInProductDetailEntity); |  |  |  |                             invPreInProductDetailDao.insert(invPreInProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -432,8 +449,17 @@ 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; | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { |  |  |  |         if (invWarehouseEntity.getAdvanceType() == ConstantStatus.ACTION_TYPE_PREIN) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             Integer count  = invPreInProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); |  |  |  |             if(bindInvSpaceRequest.getType()==3){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 QueryWrapper<InvPreInProductDetailEntity> ew=new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew.eq("code",bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvPreInProductDetailEntity invPreInProductDetailEntity=invPreInProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 count=invPreInProductDetailEntity.getInCount(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             }else{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 count  = invPreInProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(count==null || count<=0){ |  |  |  |             if(count==null || count<=0){ | 
			
		
	
		
		
			
				
					
					|  |  |  |                 return "该产品库存不足!"; |  |  |  |                 return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
	
		
		
			
				
					|  |  | @ -442,12 +468,25 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 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){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPlaceOrderDetailEntity=new InvPlaceOrderDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     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) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             Integer count  = invPreProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); |  |  |  |             if(bindInvSpaceRequest.getType()==3){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 QueryWrapper<InvPreProductDetailEntity> ew=new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew.eq("code",bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvPreProductDetailEntity invPreProductDetailEntity=invPreProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 count=invPreProductDetailEntity.getInCount(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             }else{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 count  = invPreProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(count==null || count<=0){ |  |  |  |             if(count==null || count<=0){ | 
			
		
	
		
		
			
				
					
					|  |  |  |                 return "该产品库存不足!"; |  |  |  |                 return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
	
		
		
			
				
					|  |  | @ -456,12 +495,25 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 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){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPlaceOrderDetailEntity=new InvPlaceOrderDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     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){ | 
			
		
	
		
		
			
				
					
					|  |  |  |             Integer count  = invProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); |  |  |  |             if(bindInvSpaceRequest.getType()==3){ | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 QueryWrapper<InvProductDetailEntity> ew=new QueryWrapper<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew.eq("code",bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ew.eq("invSpaceCode",bindInvSpaceRequest.getInvSpaceCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvProductDetailEntity invProductDetailEntity=invProductDetailDao.selectOne(ew); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 count=invProductDetailEntity.getInCount(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             }else{ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 count  = invProductDetailDao.getInventoryQuantity(bindInvSpaceRequest.getCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if(count==null || count<=0){ |  |  |  |             if(count==null || count<=0){ | 
			
		
	
		
		
			
				
					
					|  |  |  |                 return "该产品库存不足!"; |  |  |  |                 return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
	
		
		
			
				
					|  |  | @ -470,6 +522,10 @@ public class InvPlaceServiceImpl implements InvPlaceService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 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){ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPlaceOrderDetailEntity=new InvPlaceOrderDetailEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPlaceOrderDetailEntity.setCount(0); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if(invPlaceOrderDetailEntity.getCount()>=count){ |  |  |  |                 if(invPlaceOrderDetailEntity.getCount()>=count){ | 
			
		
	
		
		
			
				
					
					|  |  |  |                     return "该产品库存不足!"; |  |  |  |                     return "该产品库存不足!"; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
	
		
		
			
				
					|  |  | 
 |