|  |  | @ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |  |  |  | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |  |  |  | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.github.pagehelper.PageHelper; |  |  |  | import com.github.pagehelper.PageHelper; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.github.pagehelper.PageInfo; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.common.res.BaseResponse; |  |  |  | import com.glxp.api.common.res.BaseResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.common.util.ResultVOUtils; |  |  |  | import com.glxp.api.common.util.ResultVOUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.constant.Constant; |  |  |  | import com.glxp.api.constant.Constant; | 
			
		
	
	
		
		
			
				
					|  |  | @ -36,7 +35,6 @@ import com.glxp.api.entity.thrsys.ThrSystemEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.exception.JsonException; |  |  |  | import com.glxp.api.exception.JsonException; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.http.ErpBasicClient; |  |  |  | import com.glxp.api.http.ErpBasicClient; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.http.HttpOkClient; |  |  |  | import com.glxp.api.http.HttpOkClient; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.http.sync.SpGetHttpClient; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.basic.FilterUdiRelRequest; |  |  |  | import com.glxp.api.req.basic.FilterUdiRelRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.collect.CollectOrderBizRequest; |  |  |  | import com.glxp.api.req.collect.CollectOrderBizRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.collect.CollectOrderRequest; |  |  |  | import com.glxp.api.req.collect.CollectOrderRequest; | 
			
		
	
	
		
		
			
				
					|  |  | @ -51,13 +49,11 @@ import com.glxp.api.res.basic.UdiRelevanceResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.collect.CollectOrderBizResponse; |  |  |  | import com.glxp.api.res.collect.CollectOrderBizResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.collect.IoCollectOrderResponse; |  |  |  | import com.glxp.api.res.collect.IoCollectOrderResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.inout.IoOrderResponse; |  |  |  | import com.glxp.api.res.inout.IoOrderResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.inout.IoStatOrderResponse; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.res.thrsys.ThrInvProductResponse; |  |  |  | import com.glxp.api.res.thrsys.ThrInvProductResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.auth.SysWorkplaceService; |  |  |  | import com.glxp.api.service.auth.SysWorkplaceService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.basic.*; |  |  |  | import com.glxp.api.service.basic.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inout.*; |  |  |  | import com.glxp.api.service.inout.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inout.impl.IoCodeService; |  |  |  | import com.glxp.api.service.inout.impl.IoCodeService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.thrsys.SysWorkplacePutRelService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.*; |  |  |  | import com.glxp.api.util.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.udi.FilterUdiUtils; |  |  |  | import com.glxp.api.util.udi.FilterUdiUtils; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.udi.UdiCalCountUtil; |  |  |  | import com.glxp.api.util.udi.UdiCalCountUtil; | 
			
		
	
	
		
		
			
				
					|  |  | @ -87,8 +83,6 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     IoCollectOrderBizService collectOrderBizService; |  |  |  |     IoCollectOrderBizService collectOrderBizService; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     IoOrderDetailResultService orderDetailResultService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     UdiRelevanceService udiRelevanceService; |  |  |  |     UdiRelevanceService udiRelevanceService; | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     BasicSkPrescribeService basicSkPrescribeService; |  |  |  |     BasicSkPrescribeService basicSkPrescribeService; | 
			
		
	
	
		
		
			
				
					|  |  | @ -140,8 +134,6 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Resource |  |  |  |     @Resource | 
			
		
	
		
		
			
				
					
					|  |  |  |     IoCollectSetService collectSetService; |  |  |  |     IoCollectSetService collectSetService; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     public IoCollectOrder getByBillNo(String billNo) { |  |  |  |     public IoCollectOrder getByBillNo(String billNo) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return collectOrderMapper.selectOne(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, billNo).last("limit 1")); |  |  |  |         return collectOrderMapper.selectOne(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, billNo).last("limit 1")); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -235,6 +227,7 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |      * 导入内部数据 |  |  |  |      * 导入内部数据 | 
			
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void importOrder() { |  |  |  |     public void importOrder() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         importUdi(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         importPrescribe(null); |  |  |  |         importPrescribe(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -254,7 +247,6 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |                         orderService.deleteByBillNo(billNo); |  |  |  |                         orderService.deleteByBillNo(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         orderDetailBizService.deleteByOrderId(billNo); |  |  |  |                         orderDetailBizService.deleteByOrderId(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         orderDetailCodeService.deleteByOrderId(billNo); |  |  |  |                         orderDetailCodeService.deleteByOrderId(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         orderDetailResultService.deleteByOrderId(billNo); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         codeTempService.deleteByBillNo(billNo); |  |  |  |                         codeTempService.deleteByBillNo(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |                         codeService.deleteCodeByOrderId(billNo); |  |  |  |                         codeService.deleteCodeByOrderId(billNo); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -262,67 +254,71 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |         ); |  |  |  |         ); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     // TODO: 2024/10/14 下载本地单据类型
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     public BaseResponse importUdi(CollectOrderRequest collectOrderRequest) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void importUdi() { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //下载UDI内部单据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         FilterOrderRequest filterOrderRequest = new FilterOrderRequest(); |  |  |  |         FilterOrderRequest filterOrderRequest = new FilterOrderRequest(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setStatus(10); |  |  |  |         filterOrderRequest.setStatus(7); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setAction(collectOrderRequest.getBusType()); |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setProductType(null); |  |  |  |         filterOrderRequest.setProductType(null); | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setLimit(collectOrderRequest.getLimit()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setPage(collectOrderRequest.getPage()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setStartTime(collectOrderRequest.getStartTime()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setEndTime(collectOrderRequest.getEndTime()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setBillNo(collectOrderRequest.getBillNo()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setFromCorp(collectOrderRequest.getFromCorpName()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setAction(collectOrderRequest.getBusType()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         filterOrderRequest.setKeyWords(collectOrderRequest.getKeyWords()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         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()))) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 continue; |  |  |  |                 continue; | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByBusType(ioOrderEntity.getAction()); |  |  |  |             SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByBusType(ioOrderEntity.getAction()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (sysWorkplaceDocumentEntity == null) |  |  |  |             if (sysWorkplaceDocumentEntity == null) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 continue; |  |  |  |                 continue; | 
			
		
	
		
		
			
				
					
					|  |  |  |             String mainAction = ioOrderEntity.getMainAction(); |  |  |  |             List<SysWorkplaceResponse> sysWorkplaces = sysWorkplaceService.getAllByBusType(ioOrderEntity.getAction()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             String fromCorpName = ""; |  |  |  | 
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             String shipperName = ""; |  |  |  |             //自动分配工位
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             if (mainAction.equals(ConstantType.TYPE_PUT)) { |  |  |  |             final Long[] defaultWorkplace = {null}; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 shipperName = ioOrderEntity.getFromName(); |  |  |  |             if (CollUtil.isNotEmpty(sysWorkplaces)) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 fromCorpName = ioOrderEntity.getDeptName(); |  |  |  |                 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 { |  |  |  |                     } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 shipperName = ioOrderEntity.getDeptName(); |  |  |  |                         defaultWorkplace[0] = sysWorkplaces.get(0).getWorkplaceId(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 fromCorpName = ioOrderEntity.getFromName(); |  |  |  |                     } | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             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()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .fromCorpName(fromCorpName) |  |  |  |                     .workPlaceCode(defaultWorkplace[0]) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     .billTime(ioOrderEntity.getCreateTime()) |  |  |  |                     .billTime(ioOrderEntity.getCreateTime()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .shipperName(shipperName) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .createTime(ioOrderEntity.getCreateTime()) |  |  |  |                     .createTime(ioOrderEntity.getCreateTime()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .createUser(ioOrderEntity.getCreateUser()) |  |  |  |                     .createUser(ioOrderEntity.getCreateUser()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .updateTime(new Date()) |  |  |  |                     .updateTime(new Date()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .orderCirType(sysWorkplaceDocumentEntity.getOrderCirType()) |  |  |  |                     .orderCirType(sysWorkplaceDocumentEntity.getOrderCirType()) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .splitStatus(0) |  |  |  |                     .splitStatus(0) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .tagStatus(1) |  |  |  |                     .tagStatus(0) | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     .build(); |  |  |  |                     .build(); | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (collectOrder.getWorkPlaceCode() != null) { |  |  |  |             if (collectOrder.getWorkPlaceCode() != null) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 collectOrder.setTagStatus(1); |  |  |  |                 collectOrder.setTagStatus(1); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             save(collectOrder); |  |  |  |             save(collectOrder); | 
			
		
	
		
		
			
				
					
					|  |  |  |             IoCollectOrderOrigin ioCollectOrderOrigin = new IoCollectOrderOrigin(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             BeanUtils.copyProperties(collectOrder, ioCollectOrderOrigin); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             ioCollectOrderOrigin.setTagStatus(2); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             collectOrderOriginService.saveOrUpdate(ioCollectOrderOrigin); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<IoOrderDetailBizEntity> orderDetailBizEntities = orderDetailBizService.findByOrderId(ioOrderEntity.getBillNo()); |  |  |  |             List<IoOrderDetailBizEntity> orderDetailBizEntities = orderDetailBizService.findByOrderId(ioOrderEntity.getBillNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<IoCollectOrderBiz> collectOrderBizs = new ArrayList<>(); |  |  |  |             List<IoCollectOrderBiz> collectOrderBizs = new ArrayList<>(); | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<IoCollectOrderBizOrigin> collectOrderOriginBizs = new ArrayList<>(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) { |  |  |  |             for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByRelId(bizEntity.getBindRlFk() + ""); |  |  |  |                 UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByRelId(bizEntity.getBindRlFk() + ""); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 IoCollectOrderBiz collectOrderBiz = IoCollectOrderBiz.builder().orderIdFk(collectOrder.getBillNo()) |  |  |  |                 IoCollectOrderBiz collectOrderBiz = IoCollectOrderBiz.builder().orderIdFk(collectOrder.getBillNo()) | 
			
		
	
	
		
		
			
				
					|  |  | @ -346,96 +342,29 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |                     collectOrderBiz.setMeasureUnit(udiRelevanceResponse.getPrepnUnit()); |  |  |  |                     collectOrderBiz.setMeasureUnit(udiRelevanceResponse.getPrepnUnit()); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 collectOrderBizs.add(collectOrderBiz); |  |  |  |                 collectOrderBizs.add(collectOrderBiz); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 IoCollectOrderBizOrigin ioCollectOrderBizOrigin = new IoCollectOrderBizOrigin(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 BeanUtils.copyProperties(collectOrderBiz, ioCollectOrderBizOrigin); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ioCollectOrderBizOrigin.setId(null); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 collectOrderOriginBizs.add(ioCollectOrderBizOrigin); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (CollUtil.isNotEmpty(collectOrderBizs)) { |  |  |  |             if (CollUtil.isNotEmpty(collectOrderBizs)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 collectOrderBizService.saveBatch(collectOrderBizs); |  |  |  |                 collectOrderBizService.saveBatch(collectOrderBizs); | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (CollUtil.isNotEmpty(collectOrderOriginBizs)) { |  |  |  |             allWorksList.addAll(sysWorkplaces); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 collectOrderBizOriginService.saveBatch(collectOrderOriginBizs); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         return ResultVOUtils.success("下载成功"); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     public BaseResponse<PageSimpleResponse<IoCollectOrder>> selectImportUdi(FilterOrderRequest filterOrderRequest) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<IoCollectOrder> ioCollectOrders = new ArrayList<>(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         List<IoOrderResponse> list = orderService.filterList(filterOrderRequest); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         PageInfo<IoOrderResponse> pageInfo = new PageInfo<>(list); |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         for (IoOrderResponse ioOrderEntity : list) { |  |  |  |             if (IntUtil.value(sysWorkplaceDocumentEntity.getAutoTag()) == 1 && IntUtil.value(collectOrder.getTagStatus()) == 1) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             if (collectOrderMapper.exists(new LambdaQueryWrapper<IoCollectOrder>().eq(IoCollectOrder::getBillNo, ioOrderEntity.getBillNo()))) { |  |  |  |                 splitFifoCodeService.lockInventoryByOrder(collectOrder.getBillNo(), 1); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 continue; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             SysWorkplaceDocumentEntity sysWorkplaceDocumentEntity = sysWorkplaceDocumentService.findByBusType(ioOrderEntity.getAction()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (sysWorkplaceDocumentEntity == null) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 continue; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             String mainAction = ioOrderEntity.getMainAction(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             String fromCorpName = ""; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             String shipperName = ""; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (mainAction.equals(ConstantType.TYPE_PUT)) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 shipperName = ioOrderEntity.getFromName(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 fromCorpName = ioOrderEntity.getDeptName(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } else { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 shipperName = ioOrderEntity.getDeptName(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 fromCorpName = ioOrderEntity.getFromName(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             IoCollectOrder collectOrder = IoCollectOrder.builder() |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .billNo(ioOrderEntity.getBillNo()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .fromType("UDI系统") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .busType(ioOrderEntity.getAction()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .fromCorp(ioOrderEntity.getFromName()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .fromCorpName(fromCorpName) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .billTime(ioOrderEntity.getCreateTime()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .shipperName(shipperName) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .createTime(ioOrderEntity.getCreateTime()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .createUser(ioOrderEntity.getCreateUser()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .updateTime(new Date()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .orderCirType(sysWorkplaceDocumentEntity.getOrderCirType()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .splitStatus(0) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .tagStatus(0) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     .build(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             if (collectOrder.getWorkPlaceCode() != null) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 collectOrder.setTagStatus(1); |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<IoOrderDetailBizEntity> orderDetailBizEntities = orderDetailBizService.findByOrderId(ioOrderEntity.getBillNo()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             List<IoCollectOrderBiz> collectOrderBizs = new ArrayList<>(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             for (IoOrderDetailBizEntity bizEntity : orderDetailBizEntities) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 UdiRelevanceResponse udiRelevanceResponse = udiRelevanceService.selectByRelId(bizEntity.getBindRlFk() + ""); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 IoCollectOrderBiz collectOrderBiz = IoCollectOrderBiz.builder().orderIdFk(collectOrder.getBillNo()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .relId(bizEntity.getBindRlFk()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .thrCode(udiRelevanceResponse.getMainId()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .ybbm(udiRelevanceResponse.getYbbm()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .payFeeCode(udiRelevanceResponse.getPayFeeCode()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .cpmctymc(bizEntity.getCoName()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .nameCode(bizEntity.getNameCode()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .ggxh(bizEntity.getSpec()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .batchNo(bizEntity.getBatchNo()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .productDate(bizEntity.getProductDate()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .expireDate(bizEntity.getExpireDate()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .count(bizEntity.getCount()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .measureUnit(bizEntity.getMeasname()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .tagStatus(1) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         .unTagCount(bizEntity.getCount()).build(); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 if (IntUtil.value(udiRelevanceResponse.getProductsType()) == 2) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     collectOrderBiz.setGgxh(udiRelevanceResponse.getBzgg()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                     collectOrderBiz.setMeasureUnit(udiRelevanceResponse.getPrepnUnit()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                 collectOrderBizs.add(collectOrderBiz); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             collectOrder.setBizList(collectOrderBizs); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             ioCollectOrders.add(collectOrder); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        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());
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | //        }
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         PageInfo<IoCollectOrder> pageInfoReturn = new PageInfo<>(ioCollectOrders); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         BeanUtils.copyProperties(pageInfo, pageInfoReturn); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         pageInfoReturn.setList(ioCollectOrders); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         return ResultVOUtils.success(pageInfoReturn); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | @ -714,23 +643,14 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |                 .eq(IoCollectOrder::getId, collectOrderRequest.getId()).update(); |  |  |  |                 .eq(IoCollectOrder::getId, collectOrderRequest.getId()).update(); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     SysWorkplacePutRelService sysWorkplacePutRelService; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     public void finishOrder(CollectOrderRequest collectOrderRequest) { |  |  |  |     public void finishOrder(CollectOrderRequest collectOrderRequest) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         IoCollectOrder collectOrder = new IoCollectOrder(); |  |  |  |         IoCollectOrder collectOrder = new IoCollectOrder(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         BeanUtils.copyProperties(collectOrderRequest, collectOrder); |  |  |  |         BeanUtils.copyProperties(collectOrderRequest, collectOrder); | 
			
		
	
		
		
			
				
					
					|  |  |  |         collectOrder.setTagStatus(3); |  |  |  |         collectOrder.setTagStatus(3); | 
			
		
	
		
		
			
				
					
					|  |  |  |         collectOrder.setUpdateTime(new Date()); |  |  |  |         collectOrder.setUpdateTime(new Date()); | 
			
		
	
		
		
			
				
					
					|  |  |  | //        updateByBillNo(collectOrder);
 |  |  |  | //        updateByBillNo(collectOrder);
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        Long putWorkPlace = null;
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        SysWorkplacePutRel sysWorkplacePutRel = sysWorkplacePutRelService.findPutWorkPlace(collectOrder.getWorkPlaceCode(), collectOrder.getBusType());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        if (sysWorkplacePutRel != null) {
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            putWorkPlace = sysWorkplacePutRel.getWorkPlaceCode();
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //        }
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         splitCodeService.finishAutoTagCode(collectOrder); |  |  |  |         splitCodeService.finishAutoTagCode(collectOrder); | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         //插入备用表
 |  |  |  |         //插入备用表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         IoCollectOrderBackup ioCollectOrderBackup = new IoCollectOrderBackup(); |  |  |  |         IoCollectOrderBackup ioCollectOrderBackup = new IoCollectOrderBackup(); | 
			
		
	
		
		
			
				
					
					|  |  |  |         BeanUtils.copyProperties(collectOrder, ioCollectOrderBackup); |  |  |  |         BeanUtils.copyProperties(collectOrder, ioCollectOrderBackup); | 
			
		
	
	
		
		
			
				
					|  |  | @ -743,9 +663,6 @@ public class IoCollectOrderService extends ServiceImpl<IoCollectOrderMapper, IoC | 
			
		
	
		
		
			
				
					
					|  |  |  |             //插入到码表
 |  |  |  |             //插入到码表
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             collectCodeService.insertCodesByBill(collectOrderRequest.getBillNo()); |  |  |  |             collectCodeService.insertCodesByBill(collectOrderRequest.getBillNo()); | 
			
		
	
		
		
			
				
					
					|  |  |  |             //更新数据至第三方系统
 |  |  |  |             //更新数据至第三方系统
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             //单据更新
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |             ioCollectOrderBackupService.generateOrder(collectOrder.getBillNo()); |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | //            spGetHttpClient.updateCheckStatus(orderEntity,collectOrder.getCreateUser());
 |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         }); |  |  |  |         }); | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
	
		
		
			
				
					|  |  | 
 |