|  |  |  | @ -43,6 +43,7 @@ import com.glxp.api.service.inout.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.service.inout.impl.IoCodeService; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.*; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.udi.FilterUdiUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.util.udi.UdiCalCountUtil; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.beans.BeanUtils; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.context.annotation.Lazy; | 
			
		
	
		
			
				
					|  |  |  |  | import org.springframework.stereotype.Service; | 
			
		
	
	
		
			
				
					|  |  |  | @ -89,6 +90,8 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
			
				
					|  |  |  |  |     IoCollectOrderCodeManService collectOrderCodeManService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     IoCollectCodeService collectCodeService; | 
			
		
	
		
			
				
					|  |  |  |  |     @Resource | 
			
		
	
		
			
				
					|  |  |  |  |     UdiCalCountUtil udiCalCountUtil; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public IoCollectOrder getByBillNo(String billNo) { | 
			
		
	
		
			
				
					|  |  |  |  |         return collectOrderMapper.selectOne(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, billNo).last("limit 1")); | 
			
		
	
	
		
			
				
					|  |  |  | @ -439,14 +442,14 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
			
				
					|  |  |  |  |             IoCollectOrderBiz bizServiceOne = collectOrderBizService.getOne(new LambdaQueryWrapper<IoCollectOrderBiz>() | 
			
		
	
		
			
				
					|  |  |  |  |                     .eq(IoCollectOrderBiz::getId, bizIdFk)); | 
			
		
	
		
			
				
					|  |  |  |  |             if (bizServiceOne == null) throw new JsonException("扫码详情未查找到"); | 
			
		
	
		
			
				
					|  |  |  |  |             //反差单据类型 查看是否来源业务单
 | 
			
		
	
		
			
				
					|  |  |  |  |             //反查单据类型 查看是否来源业务单
 | 
			
		
	
		
			
				
					|  |  |  |  |             String orderIdFk = bizServiceOne.getOrderIdFk(); | 
			
		
	
		
			
				
					|  |  |  |  |             IoCollectOrder ioCollectOrder = collectOrderMapper.selectOne(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, orderIdFk)); | 
			
		
	
		
			
				
					|  |  |  |  |             if (ioCollectOrder == null) throw new JsonException("反差单据失败"); | 
			
		
	
		
			
				
					|  |  |  |  |             if (ioCollectOrder == null) throw new JsonException("反查单据失败"); | 
			
		
	
		
			
				
					|  |  |  |  |             String busType = ioCollectOrder.getBusType(); | 
			
		
	
		
			
				
					|  |  |  |  |             Long workPlaceCode = ioCollectOrder.getWorkPlaceCode(); | 
			
		
	
		
			
				
					|  |  |  |  |             SysWorkplaceDocumentEntity byWorkplaceCode = sysWorkplaceDocumentService.findByWorkplaceCode(workPlaceCode, busType); | 
			
		
	
		
			
				
					|  |  |  |  |             if (byWorkplaceCode == null) throw new JsonException("反差工位单据类型失败"); | 
			
		
	
		
			
				
					|  |  |  |  |             if (byWorkplaceCode == null) throw new JsonException("反查工位单据类型失败"); | 
			
		
	
		
			
				
					|  |  |  |  |             Integer scanType = byWorkplaceCode.getScanType(); | 
			
		
	
		
			
				
					|  |  |  |  |             Integer oneScanCount = bizServiceOne.getScanCount(); | 
			
		
	
		
			
				
					|  |  |  |  |             Integer newCount = oneScanCount - delCount; | 
			
		
	
	
		
			
				
					|  |  |  | @ -454,6 +457,14 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
			
				
					|  |  |  |  |                 collectOrderBizService.removeById(bizServiceOne); | 
			
		
	
		
			
				
					|  |  |  |  |             } else { | 
			
		
	
		
			
				
					|  |  |  |  |                 bizServiceOne.setScanCount(newCount); | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 List<UdiRelevanceResponse> udiRelevanceResponses = udiRelevanceService.selectGroupByNameCode(bizServiceOne.getNameCode(), null); | 
			
		
	
		
			
				
					|  |  |  |  |                 if (IntUtil.value(byWorkplaceCode.getOrderCirType()) == 1) { | 
			
		
	
		
			
				
					|  |  |  |  |                     bizServiceOne.setScanActCount(IntUtil.value(bizServiceOne.getScanActCount()) -  udiCalCountUtil.getCirActCount(udiRelevanceResponses.get(0))); | 
			
		
	
		
			
				
					|  |  |  |  |                 } else { | 
			
		
	
		
			
				
					|  |  |  |  |                     bizServiceOne.setScanActCount(IntUtil.value(bizServiceOne.getScanActCount()) -  udiCalCountUtil.getUseActCount(udiRelevanceResponses.get(0))); | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |                 collectOrderBizService.updateById(bizServiceOne); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
	
		
			
				
					|  |  |  | 
 |