|  |  | @ -207,8 +207,29 @@ public class IoOrderServiceImpl implements IoOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); |  |  |  |                 BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 //判断单据是否是预验收单据,如果是预验收单据,则删除预验收库库存
 |  |  |  |                 //判断单据是否是预验收单据,如果是预验收单据,则删除预验收库库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) { |  |  |  |                 if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     preinOrderService.deleteByOrderId(billNo); |  |  |  |                     //删除普通库存
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     preinDetailService.deleteByOrderId(billNo); |  |  |  |                     List<InvPreInProductDetailEntity> invProductDetailEntities = invPreinProductDetailService.selectByOrderIdFk(billNo); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (CollUtil.isNotEmpty(invProductDetailEntities)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         for (InvPreInProductDetailEntity invProductDetailEntity : invProductDetailEntities) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             //更新库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             InvPreinProductEntity invProductEntity = invPreinProductService.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()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 invPreinProductService.update(invProductEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         //删除库存详情
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPreinProductDetailService.deleteByOrderId(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } else if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_ADVANCE) { |  |  |  |                 } else if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_ADVANCE) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     //是否寄售,删除寄售库存
 |  |  |  |                     //是否寄售,删除寄售库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     List<InvPreProductDetailEntity> invProductDetailEntities = invPreProductDetailService.selectByOrderIdFk(billNo); |  |  |  |                     List<InvPreProductDetailEntity> invProductDetailEntities = invPreProductDetailService.selectByOrderIdFk(billNo); | 
			
		
	
	
		
		
			
				
					|  |  | @ -299,20 +320,33 @@ public class IoOrderServiceImpl implements IoOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_AUDITED) { |  |  |  |             if (orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_AUDITED) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); |  |  |  |                 BasicBussinessTypeEntity basicBussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 //预验收库存
 |  |  |  |                 //预验收库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) { |  |  |  |                 if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     InvPreinDetailEntity invPreinDetailEntity = preinDetailService.findByCode(billNo, code); |  |  |  |                     InvPreInProductDetailEntity invProductDetailEntity = invPreinProductDetailService.selectByCode(billNo, code); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                     int count = invPreinDetailEntity.getCount() - 1; |  |  |  |                     int count = invProductDetailEntity.getCount() - 1; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     if (count == 0) { |  |  |  |                     if (count == 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         preinDetailService.deleteById(invPreinDetailEntity.getId()); |  |  |  |                         invPreinProductDetailService.deleteById(invProductDetailEntity.getId() + ""); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     } else { |  |  |  |                     } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreinDetailEntity.setCount(count); |  |  |  |                         //更新详情表
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         int reCount = udiCalCountUtil.getActCount(invPreinDetailEntity.getNameCode()); |  |  |  |                         invProductDetailEntity.setCount(count); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         invPreinDetailEntity.setReCount(invPreinDetailEntity.getReCount() - reCount); |  |  |  |                         int reCount = udiCalCountUtil.getActCount(invProductDetailEntity.getNameCode()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                         preinDetailService.update(invPreinDetailEntity); |  |  |  |                         invProductDetailEntity.setReCount(invProductDetailEntity.getReCount() - reCount); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invPreinProductDetailService.update(invProductDetailEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     //更新产品表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     if (invProductEntity != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         if (ConstantType.TYPE_PUT.equals(invProductDetailEntity.getMainAction())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             int inCount = invProductEntity.getInCount() - invProductDetailEntity.getReCount(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invProductEntity.setInCount(inCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } else if (ConstantType.TYPE_OUT.equals(invProductDetailEntity.getMainAction())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             int outCount = invProductEntity.getOutCount() - invProductDetailEntity.getReCount(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invProductEntity.setOutCount(outCount); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         invProductEntity.setReCount(invProductEntity.getInCount() - invProductEntity.getOutCount()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPreinProductService.update(invProductEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } else if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_ADVANCE) {  //寄售库存
 |  |  |  |                 } else if (basicBussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_ADVANCE) {  //寄售库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     InvPreProductDetailEntity invProductDetailEntity = invPreProductDetailService.selectByCode(billNo, code); |  |  |  |                     InvPreProductDetailEntity invProductDetailEntity = invPreProductDetailService.selectByCode(billNo, code); | 
			
		
	
	
		
		
			
				
					|  |  | @ -388,9 +422,9 @@ public class IoOrderServiceImpl implements IoOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     InvPreinOrderService invPreinOrderService; |  |  |  |     InvPreinProductService invPreinProductService; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     InvPreinDetailService invPreinDetailService; |  |  |  |     InvPreinProductDetailService invPreinProductDetailService; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     //已验收单据撤回
 |  |  |  |     //已验收单据撤回
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Override |  |  |  |     @Override | 
			
		
	
	
		
		
			
				
					|  |  | @ -401,8 +435,43 @@ public class IoOrderServiceImpl implements IoOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         //预验收撤回---直接删除预验收库存
 |  |  |  |         //预验收撤回---直接删除预验收库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (bussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) { |  |  |  |         if (bussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_PREIN) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             invPreinOrderService.deleteByOrderId(billNo); |  |  |  |             List<InvPreInProductDetailEntity> invProductDetailEntities = invPreinProductDetailService.selectByOrderIdFk(billNo); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             invPreinDetailService.deleteByOrderId(billNo); |  |  |  |             if (CollUtil.isNotEmpty(invProductDetailEntities)) { | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 for (InvPreInProductDetailEntity invProductDetailEntity : invProductDetailEntities) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     InvPreinProductEntity invProductEntity = invPreinProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     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()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     invPreinProductService.update(invProductEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPreinProductDetailService.deleteByOrderId(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } else if (bussinessTypeEntity.getActionType() == ConstantStatus.ACTION_TYPE_ADVANCE) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             List<InvPreProductDetailEntity> invProductDetailEntities = invPreProductDetailService.selectByOrderIdFk(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (CollUtil.isNotEmpty(invProductDetailEntities)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 for (InvPreProductDetailEntity invProductDetailEntity : invProductDetailEntities) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     InvPreProductEntity invProductEntity = invPreProductService.selectByUnique(invProductDetailEntity.getRelId(), invProductDetailEntity.getBatchNo(), invProductDetailEntity.getSupId(), | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             invProductDetailEntity.getDeptCode(), invProductDetailEntity.getInvCode()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     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); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invPreProductDetailService.deleteByOrderId(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |         } else { |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.selectByOrderIdFk(billNo); |  |  |  |             List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.selectByOrderIdFk(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (CollUtil.isNotEmpty(invProductDetailEntities)) { |  |  |  |             if (CollUtil.isNotEmpty(invProductDetailEntities)) { | 
			
		
	
	
		
		
			
				
					|  |  | 
 |