| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -137,8 +137,6 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public void importUdi() {
 | 
					 | 
					 | 
					 | 
					    public void importUdi() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //下载UDI内部单据
 | 
					 | 
					 | 
					 | 
					        //下载UDI内部单据
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        FilterOrderRequest filterOrderRequest = new FilterOrderRequest();
 | 
					 | 
					 | 
					 | 
					        FilterOrderRequest filterOrderRequest = new FilterOrderRequest();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//        filterOrderRequest.setPage(1);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//        filterOrderRequest.setLimit(1000);
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        filterOrderRequest.setStatus(7);
 | 
					 | 
					 | 
					 | 
					        filterOrderRequest.setStatus(7);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        filterOrderRequest.setProductType(null);
 | 
					 | 
					 | 
					 | 
					        filterOrderRequest.setProductType(null);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<IoOrderResponse> list = orderService.filterList(filterOrderRequest);
 | 
					 | 
					 | 
					 | 
					        List<IoOrderResponse> list = orderService.filterList(filterOrderRequest);
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -151,9 +149,11 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//            BasicCollectBustypeEntity collectBustypeEntity = collectBustypeService.findByAddr(ioOrderEntity.getAction());
 | 
					 | 
					 | 
					 | 
					//            BasicCollectBustypeEntity collectBustypeEntity = collectBustypeService.findByAddr(ioOrderEntity.getAction());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//            if (collectBustypeEntity == null)
 | 
					 | 
					 | 
					 | 
					//            if (collectBustypeEntity == null)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//                continue;
 | 
					 | 
					 | 
					 | 
					//                continue;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByBusType(ioOrderEntity.getAction());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (sysWorkplaceDocumentEntity == null)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                continue;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            List<SysWorkplaceResponse> sysWorkplaces = sysWorkplaceService.getAllByBusType(ioOrderEntity.getAction());
 | 
					 | 
					 | 
					 | 
					            List<SysWorkplaceResponse> sysWorkplaces = sysWorkplaceService.getAllByBusType(ioOrderEntity.getAction());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //自动分配工位
 | 
					 | 
					 | 
					 | 
					            //自动分配工位
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            final Long[] defaultWorkplace = {null};
 | 
					 | 
					 | 
					 | 
					            final Long[] defaultWorkplace = {null};
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (CollUtil.isNotEmpty(sysWorkplaces)) {
 | 
					 | 
					 | 
					 | 
					            if (CollUtil.isNotEmpty(sysWorkplaces)) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -240,15 +240,19 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<IoCollectOrder> collectOrderList = new ArrayList<>();
 | 
					 | 
					 | 
					 | 
					        List<IoCollectOrder> collectOrderList = new ArrayList<>();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for (BasicSkPrescribeEntity basicSkPrescribeEntity : basicSkPrescribeEntities) {
 | 
					 | 
					 | 
					 | 
					        for (BasicSkPrescribeEntity basicSkPrescribeEntity : basicSkPrescribeEntities) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            BasicCollectBustypeEntity collectBustypeEntity = collectBustypeService.findByCode(String.valueOf(basicSkPrescribeEntity.getAddr()));
 | 
					 | 
					 | 
					 | 
					//            BasicCollectBustypeEntity collectBustypeEntity = collectBustypeService.findByFromCode(String.valueOf(basicSkPrescribeEntity.getAddr()));
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (collectBustypeEntity == null)
 | 
					 | 
					 | 
					 | 
					//            if (collectBustypeEntity == null)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                continue;
 | 
					 | 
					 | 
					 | 
					//                continue;
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (collectOrderMapper.exists(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, basicSkPrescribeEntity.getCode()))) {
 | 
					 | 
					 | 
					 | 
					            if (collectOrderMapper.exists(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, basicSkPrescribeEntity.getCode()))) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                continue;
 | 
					 | 
					 | 
					 | 
					                continue;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }
 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByBusType(basicSkPrescribeEntity.getAddr());
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (sysWorkplaceDocumentEntity == null)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                continue;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            //自动分配工位
 | 
					 | 
					 | 
					 | 
					            //自动分配工位
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            final Long[] defaultWorkplace = {null};
 | 
					 | 
					 | 
					 | 
					            final Long[] defaultWorkplace = {null};
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            List<SysWorkplaceResponse> sysWorkplaces = sysWorkplaceService.getAllByBusType(collectBustypeEntity.getCode());
 | 
					 | 
					 | 
					 | 
					            List<SysWorkplaceResponse> sysWorkplaces = sysWorkplaceService.getAllByBusType(basicSkPrescribeEntity.getAddr());
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (CollUtil.isNotEmpty(sysWorkplaces)) {
 | 
					 | 
					 | 
					 | 
					            if (CollUtil.isNotEmpty(sysWorkplaces)) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (sysWorkplaces.size() == 1) {
 | 
					 | 
					 | 
					 | 
					                if (sysWorkplaces.size() == 1) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    defaultWorkplace[0] = sysWorkplaces.get(0).getWorkplaceId();
 | 
					 | 
					 | 
					 | 
					                    defaultWorkplace[0] = sysWorkplaces.get(0).getWorkplaceId();
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -276,8 +280,8 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            IoCollectOrder collectOrder = IoCollectOrder.builder()
 | 
					 | 
					 | 
					 | 
					            IoCollectOrder collectOrder = IoCollectOrder.builder()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    .billNo(basicSkPrescribeEntity.getCode())
 | 
					 | 
					 | 
					 | 
					                    .billNo(basicSkPrescribeEntity.getCode())
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    .busType(collectBustypeEntity.getCode())
 | 
					 | 
					 | 
					 | 
					                    .busType(sysWorkplaceDocumentEntity.getDocumentTypeCode())
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    .fromType(collectBustypeEntity.getFromType())
 | 
					 | 
					 | 
					 | 
					                    .fromType("HIS系统")
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    .fromCorp(basicSkPrescribeEntity.getSickerCode())
 | 
					 | 
					 | 
					 | 
					                    .fromCorp(basicSkPrescribeEntity.getSickerCode())
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    .workPlaceCode(defaultWorkplace[0])
 | 
					 | 
					 | 
					 | 
					                    .workPlaceCode(defaultWorkplace[0])
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    .billTime(MsDateUtil.localToDate(basicSkPrescribeEntity.getCreateTime()))
 | 
					 | 
					 | 
					 | 
					                    .billTime(MsDateUtil.localToDate(basicSkPrescribeEntity.getCreateTime()))
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -350,10 +354,23 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            IoCollectOrderBiz bizServiceOne = collectOrderBizService.getOne(new LambdaQueryWrapper<IoCollectOrderBiz>()
 | 
					 | 
					 | 
					 | 
					            IoCollectOrderBiz bizServiceOne = collectOrderBizService.getOne(new LambdaQueryWrapper<IoCollectOrderBiz>()
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    .eq(IoCollectOrderBiz::getId, bizIdFk));
 | 
					 | 
					 | 
					 | 
					                    .eq(IoCollectOrderBiz::getId, bizIdFk));
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (bizServiceOne == null) throw new JsonException("扫码详情未查找到");
 | 
					 | 
					 | 
					 | 
					            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("反差单据失败");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            String busType = ioCollectOrder.getBusType();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            Long workPlaceCode = ioCollectOrder.getWorkPlaceCode();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            SysWorkplaceDocumentEntity byWorkplaceCode = sysWorkplaceDocumentService.findByWorkplaceCode(workPlaceCode, busType);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (byWorkplaceCode == null) throw new JsonException("反差工位单据类型失败");
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            Integer scanType = byWorkplaceCode.getScanType();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Integer oneScanCount = bizServiceOne.getScanCount();
 | 
					 | 
					 | 
					 | 
					            Integer oneScanCount = bizServiceOne.getScanCount();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Integer newCount = oneScanCount - delCount;
 | 
					 | 
					 | 
					 | 
					            Integer newCount = oneScanCount - delCount;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            bizServiceOne.setScanCount(newCount);
 | 
					 | 
					 | 
					 | 
					            if (scanType == 1 && newCount <= 0){
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            collectOrderBizService.updateById(bizServiceOne);
 | 
					 | 
					 | 
					 | 
					                collectOrderBizService.removeById(bizServiceOne);
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }else {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                bizServiceOne.setScanCount(newCount);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                collectOrderBizService.updateById(bizServiceOne);
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					        }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    }
 | 
					 | 
					 | 
					 | 
					    }
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |