|  |  | @ -31,6 +31,7 @@ import com.glxp.api.service.inv.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.DateUtil; |  |  |  | import com.glxp.api.util.DateUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.udi.UdiCalCountUtil; |  |  |  | import com.glxp.api.util.udi.UdiCalCountUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import lombok.extern.slf4j.Slf4j; |  |  |  | import lombok.extern.slf4j.Slf4j; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import org.springframework.beans.BeanUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.stereotype.Service; |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
		
		
			
				
					
					|  |  |  | import org.springframework.transaction.annotation.Transactional; |  |  |  | import org.springframework.transaction.annotation.Transactional; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -73,6 +74,10 @@ public class IoOrderServiceImpl implements IoOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |     IoCodeService codeService; |  |  |  |     IoCodeService codeService; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     IoCodeTempService codeTempService; |  |  |  |     IoCodeTempService codeTempService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     IoOrderDetailCodeService ioOrderDetailCodeService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     IoOrderDetailResultService ioOrderDetailResultService; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Override |  |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |     public List<IoOrderEntity> selectAll() { |  |  |  |     public List<IoOrderEntity> selectAll() { | 
			
		
	
	
		
		
			
				
					|  |  | @ -210,12 +215,6 @@ public class IoOrderServiceImpl implements IoOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return 0; |  |  |  |         return 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     IoOrderDetailCodeService ioOrderDetailCodeService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     IoOrderDetailResultService ioOrderDetailResultService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     //单据编辑条码减一
 |  |  |  |     //单据编辑条码减一
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Override |  |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |     public int deleteInvCode(String billNo, String code) { |  |  |  |     public int deleteInvCode(String billNo, String code) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -337,6 +336,73 @@ public class IoOrderServiceImpl implements IoOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return 0; |  |  |  |         return 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     InvPreinOrderService invPreinOrderService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     InvPreinDetailService invPreinDetailService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     //已验收单据撤回
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public boolean rollbackOrder(String billNo) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         IoOrderEntity orderEntity = findByBillNo(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(orderEntity.getAction()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //预验收撤回---直接删除预验收库存
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (bussinessTypeEntity.isPreIn()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             invPreinOrderService.deleteByOrderId(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             invPreinDetailService.deleteByOrderId(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         List<InvProductDetailEntity> invProductDetailEntities = invProductDetailService.selectByOrderIdFk(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if (CollUtil.isNotEmpty(invProductDetailEntities)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             for (InvProductDetailEntity invProductDetailEntity : invProductDetailEntities) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 InvProductEntity invProductEntity = invProductService.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); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 invProductService.update(invProductEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             invProductDetailService.deleteByOrderId(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_POST); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK_SUCCESS); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         orderEntity.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         update(orderEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public boolean rollbackUnReOrder(String billNo) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         IoOrderEntity orderEntity = findByBillNo(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         List<IoCodeEntity> codeEntityList = codeService.findByOrderId(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         List<IoCodeTempEntity> codeTempEntities = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         for (IoCodeEntity codeEntity : codeEntityList) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             IoCodeTempEntity codeTempEntity = new IoCodeTempEntity(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             BeanUtils.copyProperties(codeEntity, codeTempEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             codeTempEntity.setId(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             codeTempEntities.add(codeTempEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         codeTempService.insertBatch(codeTempEntities); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         codeService.deleteCodeByOrderId(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         orderEntity.setDealStatus(ConstantStatus.ORDER_DEAL_POST); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         orderEntity.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         update(orderEntity); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Override |  |  |  |     @Override | 
			
		
	
		
		
			
				
					
					|  |  |  |     public List<IoOrderResponse> filterList(FilterOrderRequest filterOrderRequest) { |  |  |  |     public List<IoOrderResponse> filterList(FilterOrderRequest filterOrderRequest) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (null == filterOrderRequest) { |  |  |  |         if (null == filterOrderRequest) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -476,6 +542,7 @@ public class IoOrderServiceImpl implements IoOrderService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         orderDao.update(order, new QueryWrapper<IoOrderEntity>().in("billNo", orderEditRequest.getOrderIds())); |  |  |  |         orderDao.update(order, new QueryWrapper<IoOrderEntity>().in("billNo", orderEditRequest.getOrderIds())); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |      * 查询此单据关联的所有单据 |  |  |  |      * 查询此单据关联的所有单据 | 
			
		
	
		
		
			
				
					
					|  |  |  |      * |  |  |  |      * | 
			
		
	
	
		
		
			
				
					|  |  | 
 |