|  |  | @ -227,7 +227,6 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |      * 导入内部数据 |  |  |  |      * 导入内部数据 | 
			
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void importOrder() { |  |  |  |     public void importOrder() { | 
			
		
	
		
		
			
				
					
					|  |  |  |         importUdi(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         importPrescribe(null); |  |  |  |         importPrescribe(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -254,15 +253,13 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |         ); |  |  |  |         ); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |     // TODO: 2024/10/14 下载本地单据类型 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |     public void importUdi() { |  |  |  |     public void importUdi(String action) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         //下载UDI内部单据
 |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         FilterOrderRequest filterOrderRequest = new FilterOrderRequest(); |  |  |  |         FilterOrderRequest filterOrderRequest = new FilterOrderRequest(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setStatus(7); |  |  |  |         filterOrderRequest.setStatus(7); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         filterOrderRequest.setAction(action); | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setProductType(null); |  |  |  |         filterOrderRequest.setProductType(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<IoOrderResponse> list = orderService.filterList(filterOrderRequest); |  |  |  |         List<IoOrderResponse> list = orderService.filterList(filterOrderRequest); | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<IoCollectOrder> collectOrderList = new ArrayList<>(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<SysWorkplaceResponse> allWorksList = new ArrayList<>(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         for (IoOrderResponse ioOrderEntity : list) { |  |  |  |         for (IoOrderResponse ioOrderEntity : list) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (collectOrderMapper.exists(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, ioOrderEntity.getBillNo()))) { |  |  |  |             if (collectOrderMapper.exists(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, ioOrderEntity.getBillNo()))) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -271,39 +268,11 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |             SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByBusType(ioOrderEntity.getAction()); |  |  |  |             SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByBusType(ioOrderEntity.getAction()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (sysWorkplaceDocumentEntity == null) |  |  |  |             if (sysWorkplaceDocumentEntity == null) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 continue; |  |  |  |                 continue; | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<SysWorkplaceResponse> sysWorkplaces = sysWorkplaceService.getAllByBusType(ioOrderEntity.getAction()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             //自动分配工位
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             final Long[] defaultWorkplace = {null}; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (CollUtil.isNotEmpty(sysWorkplaces)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (sysWorkplaces.size() == 1) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     defaultWorkplace[0] = sysWorkplaces.get(0).getWorkplaceId(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } else { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     List<SysWorkplaceResponse> addWorkplace = new ArrayList<>(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     for (SysWorkplaceResponse sysWorkplace : sysWorkplaces) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         //获取是否有正在处理的工位
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         List<IoCollectOrder> collectOrderList1 = collectOrderMapper.selectList(new LambdaQueryWrapper<IoCollectOrder>() |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 .eq(IoCollectOrder::getWorkPlaceCode, sysWorkplace.getWorkplaceId()).in(IoCollectOrder::getTagStatus, -1, 1, 2)); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         sysWorkplace.setOrderCount(collectOrderList1.size()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         if (IntUtil.value(sysWorkplace.getOrderCount()) > 0) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                             addWorkplace.add(sysWorkplace); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     if (addWorkplace.size() > 0) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         Optional<SysWorkplaceResponse> minCountObject = addWorkplace.stream() |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 .min((o1, o2) -> Integer.compare(o1.getOrderCount(), o2.getOrderCount())); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         minCountObject.ifPresent(sysWorkplace -> defaultWorkplace[0] = sysWorkplace.getWorkplaceId()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } else { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         defaultWorkplace[0] = sysWorkplaces.get(0).getWorkplaceId(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             IoCollectOrder collectOrder = IoCollectOrder.builder() |  |  |  |             IoCollectOrder collectOrder = IoCollectOrder.builder() | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .billNo(ioOrderEntity.getBillNo()) |  |  |  |                     .billNo(ioOrderEntity.getBillNo()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .fromType("UDI系统") |  |  |  |                     .fromType("UDI系统") | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .busType(ioOrderEntity.getAction()) |  |  |  |                     .busType(ioOrderEntity.getAction()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .fromCorp(ioOrderEntity.getFromName()) |  |  |  |                     .fromCorp(ioOrderEntity.getFromName()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .workPlaceCode(defaultWorkplace[0]) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .billTime(ioOrderEntity.getCreateTime()) |  |  |  |                     .billTime(ioOrderEntity.getCreateTime()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .createTime(ioOrderEntity.getCreateTime()) |  |  |  |                     .createTime(ioOrderEntity.getCreateTime()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .createUser(ioOrderEntity.getCreateUser()) |  |  |  |                     .createUser(ioOrderEntity.getCreateUser()) | 
			
		
	
	
		
		
			
				
					|  |  | @ -317,7 +286,6 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             save(collectOrder); |  |  |  |             save(collectOrder); | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<IoOrderDetailBizEntity> orderDetailBizEntities = orderDetailBizService.findByOrderId(ioOrderEntity.getBillNo()); |  |  |  |             List<IoOrderDetailBizEntity> orderDetailBizEntities = orderDetailBizService.findByOrderId(ioOrderEntity.getBillNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<IoCollectOrderBiz> collectOrderBizs = new ArrayList<>(); |  |  |  |             List<IoCollectOrderBiz> collectOrderBizs = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |             for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) { |  |  |  |             for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByRelId(bizEntity.getBindRlFk() + ""); |  |  |  |                 UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByRelId(bizEntity.getBindRlFk() + ""); | 
			
		
	
	
		
		
			
				
					|  |  | @ -346,25 +314,7 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (CollUtil.isNotEmpty(collectOrderBizs)) { |  |  |  |             if (CollUtil.isNotEmpty(collectOrderBizs)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 collectOrderBizService.saveBatch(collectOrderBizs); |  |  |  |                 collectOrderBizService.saveBatch(collectOrderBizs); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             allWorksList.addAll(sysWorkplaces); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (IntUtil.value(sysWorkplaceDocumentEntity.getAutoTag()) == 1 && IntUtil.value(collectOrder.getTagStatus()) == 1) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 splitFifoCodeService.lockInventoryByOrder(collectOrder.getBillNo(), 1); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | //        if (CollUtil.isNotEmpty(collectOrderList)) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            saveBatch(collectOrderList);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        Map<Long, SysWorkplaceResponse> sysWorkplaceMap = new HashMap<>();
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        for (SysWorkplaceResponse sysWorkplace : allWorksList) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            sysWorkplaceMap.put(sysWorkplace.getId(), sysWorkplace);
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        for (SysWorkplaceResponse value : sysWorkplaceMap.values()) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            splitFifoCodeService.preAllotInv(value.getWorkplaceId());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |