|  |  |  | @ -190,43 +190,52 @@ public class IoOrderServiceImpl implements IoOrderService { | 
			
		
	
		
			
				
					|  |  |  |  |                 } else if (basicBussinessTypeEntity.isAdvanceType()) { | 
			
		
	
		
			
				
					|  |  |  |  |                     //是否寄售,删除寄售库存
 | 
			
		
	
		
			
				
					|  |  |  |  |                     List<InvPreProductDetailEntity> invProductDetailEntities = invPreProductDetailService.selectByOrderIdFk(billNo); | 
			
		
	
		
			
				
					|  |  |  |  |                     for (InvPreProductDetailEntity invProductDetailEntity : invProductDetailEntities) { | 
			
		
	
		
			
				
					|  |  |  |  |                         //更新库存
 | 
			
		
	
		
			
				
					|  |  |  |  |                         InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                         if (invProductEntity != null) { | 
			
		
	
		
			
				
					|  |  |  |  |                             if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); | 
			
		
	
		
			
				
					|  |  |  |  |                                 invProductEntity.setInCount(count); | 
			
		
	
		
			
				
					|  |  |  |  |                             } else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount(); | 
			
		
	
		
			
				
					|  |  |  |  |                                 invProductEntity.setOutCount(count); | 
			
		
	
		
			
				
					|  |  |  |  |                     if (CollUtil.isNotEmpty(invProductDetailEntities)) { | 
			
		
	
		
			
				
					|  |  |  |  |                         for (InvPreProductDetailEntity invProductDetailEntity : invProductDetailEntities) { | 
			
		
	
		
			
				
					|  |  |  |  |                             //更新库存
 | 
			
		
	
		
			
				
					|  |  |  |  |                             InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                             if (invProductEntity != null) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { | 
			
		
	
		
			
				
					|  |  |  |  |                                     int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); | 
			
		
	
		
			
				
					|  |  |  |  |                                     invProductEntity.setInCount(count); | 
			
		
	
		
			
				
					|  |  |  |  |                                 } else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) { | 
			
		
	
		
			
				
					|  |  |  |  |                                     int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount(); | 
			
		
	
		
			
				
					|  |  |  |  |                                     invProductEntity.setOutCount(count); | 
			
		
	
		
			
				
					|  |  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                                 //计算实际数量
 | 
			
		
	
		
			
				
					|  |  |  |  |                                 invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount()); | 
			
		
	
		
			
				
					|  |  |  |  |                                 invPreProductService.update(invProductEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreProductService.update(invProductEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                         //删除库存详情
 | 
			
		
	
		
			
				
					|  |  |  |  |                         invPreProductDetailService.deleteByOrderId(billNo); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     //删除库存详情
 | 
			
		
	
		
			
				
					|  |  |  |  |                     invPreProductDetailService.deleteByOrderId(billNo); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 } else { | 
			
		
	
		
			
				
					|  |  |  |  |                     //删除普通库存
 | 
			
		
	
		
			
				
					|  |  |  |  |                     List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.selectByOrderIdFk(billNo); | 
			
		
	
		
			
				
					|  |  |  |  |                     for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) { | 
			
		
	
		
			
				
					|  |  |  |  |                         //更新库存
 | 
			
		
	
		
			
				
					|  |  |  |  |                         InvProductEntity invProductEntity = invProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                         if (invProductEntity != null) { | 
			
		
	
		
			
				
					|  |  |  |  |                             if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); | 
			
		
	
		
			
				
					|  |  |  |  |                                 invProductEntity.setInCount(count); | 
			
		
	
		
			
				
					|  |  |  |  |                             } else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount(); | 
			
		
	
		
			
				
					|  |  |  |  |                                 invProductEntity.setOutCount(count); | 
			
		
	
		
			
				
					|  |  |  |  |                     if (CollUtil.isNotEmpty(invProductDetailEntities)) { | 
			
		
	
		
			
				
					|  |  |  |  |                         for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) { | 
			
		
	
		
			
				
					|  |  |  |  |                             //更新库存
 | 
			
		
	
		
			
				
					|  |  |  |  |                             InvProductEntity invProductEntity = invProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); | 
			
		
	
		
			
				
					|  |  |  |  |                             if (invProductEntity != null) { | 
			
		
	
		
			
				
					|  |  |  |  |                                 if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { | 
			
		
	
		
			
				
					|  |  |  |  |                                     int count = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); | 
			
		
	
		
			
				
					|  |  |  |  |                                     invProductEntity.setInCount(count); | 
			
		
	
		
			
				
					|  |  |  |  |                                 } else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) { | 
			
		
	
		
			
				
					|  |  |  |  |                                     int count = invProductEntity.getOutCount() - invProductDetailEntity.getReCount(); | 
			
		
	
		
			
				
					|  |  |  |  |                                     invProductEntity.setOutCount(count); | 
			
		
	
		
			
				
					|  |  |  |  |                                 } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                                 //计算实际数量
 | 
			
		
	
		
			
				
					|  |  |  |  |                                 invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount()); | 
			
		
	
		
			
				
					|  |  |  |  |                                 invProductService.update(invProductEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                             } | 
			
		
	
		
			
				
					|  |  |  |  |                         } | 
			
		
	
		
			
				
					|  |  |  |  |                         invProductService.update(invProductEntity); | 
			
		
	
		
			
				
					|  |  |  |  |                         //删除库存详情
 | 
			
		
	
		
			
				
					|  |  |  |  |                         invProductDetailService.deleteByOrderId(billNo); | 
			
		
	
		
			
				
					|  |  |  |  |                     } | 
			
		
	
		
			
				
					|  |  |  |  |                     //删除库存详情
 | 
			
		
	
		
			
				
					|  |  |  |  |                     invProductDetailService.deleteByOrderId(billNo); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
	
		
			
				
					|  |  |  | @ -498,7 +507,7 @@ public class IoOrderServiceImpl implements IoOrderService { | 
			
		
	
		
			
				
					|  |  |  |  |                 filterOrderRequest.setOrderType(ConstantStatus.ORDER_TYPE_SCAN); | 
			
		
	
		
			
				
					|  |  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |  |             case Constant.ORDER_STATUS_NEW_ORDER: | 
			
		
	
		
			
				
					|  |  |  |  |                 filterOrderRequest.setStatuses(Arrays.asList(1, 2,  4)); | 
			
		
	
		
			
				
					|  |  |  |  |                 filterOrderRequest.setStatuses(Arrays.asList(1, 2, 4)); | 
			
		
	
		
			
				
					|  |  |  |  |                 filterOrderRequest.setDealStatuses(Arrays.asList(1, 2)); | 
			
		
	
		
			
				
					|  |  |  |  |                 break; | 
			
		
	
		
			
				
					|  |  |  |  |             case Constant.ORDER_STATUS_UN_CHECK: | 
			
		
	
	
		
			
				
					|  |  |  | @ -680,11 +689,12 @@ public class IoOrderServiceImpl implements IoOrderService { | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         ArrayList<IoOrderEntity> orders = new ArrayList<>(); | 
			
		
	
		
			
				
					|  |  |  |  |         if (CollUtil.isNotEmpty(orders)) { | 
			
		
	
		
			
				
					|  |  |  |  |         if (CollUtil.isNotEmpty(billNos)) { | 
			
		
	
		
			
				
					|  |  |  |  |             List<IoOrderEntity> list = orderDao.selectList(new QueryWrapper<IoOrderEntity>().in("billNo", billNos).orderByDesc("id")); | 
			
		
	
		
			
				
					|  |  |  |  |             orders.addAll(list); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         orders.add(order); | 
			
		
	
		
			
				
					|  |  |  |  |         //将查询入口单据放在第一位的顺序
 | 
			
		
	
		
			
				
					|  |  |  |  |         orders.add(0, order); | 
			
		
	
		
			
				
					|  |  |  |  |         return orders; | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
	
		
			
				
					|  |  |  | 
 |