| | |
| | | // 立即触发异步任务,不等待结果 |
| | | if (!Cools.isEmpty(palletId.get()) && StringUtils.isNotBlank(syncOrder.getOrderNo()) && !Cools.isEmpty(syncOrder.getStationId())) { |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, palletId.get())); |
| | | if (!Cools.isEmpty(loc)) { |
| | | if (!Cools.isEmpty(loc) && loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | // outStockService.getOrderOutTaskItem(orderOutTaskParam,param.getOrderItemId()); |
| | | //出库 |
| | | // boolean itemsCheck = waitPakinService.mergeItemsCheck(pakinParam, loginUserId); |
| | | // if (true) { |
| | | CompletableFuture.runAsync(() -> { |
| | | try { |
| | | asyncOutboundExecutionWcs(syncOrder.getStationId(), wkOrder.getId(), loginUserId); |
| | | asyncOutboundExecutionWcs(syncOrder.getStationId(), wkOrder.getId(), loginUserId,loc.getCode()); |
| | | } catch (Exception e) { |
| | | log.warn("订单 {} 开始自动出库", syncOrder.getOrderNo()); |
| | | } |
| | |
| | | } |
| | | |
| | | @Async |
| | | public void asyncOutboundExecutionWcs(String stationId ,Long orderId, Long loginUserId) { |
| | | public void asyncOutboundExecutionWcs(String stationId ,Long orderId, Long loginUserId,String locCode) { |
| | | try { |
| | | |
| | | GenWaveParams genWaveParams = new GenWaveParams(); |
| | |
| | | // return; |
| | | // } |
| | | // outStockService.genOutStockTask(tasks, loginUserId, orderId); |
| | | R r = outStockService.generateWavesOrderAuto(genWaveParams, stationId); |
| | | R r = outStockService.generateWavesOrderAuto(genWaveParams, stationId,locCode); |
| | | |
| | | log.info("订单ID {} 自动转波次", orderId); |
| | | } catch (Exception e) { |
| | |
| | | @ApiModelProperty(value= "指定站点") |
| | | private String stationId; |
| | | |
| | | /** |
| | | * 指定库位 |
| | | */ |
| | | @ApiModelProperty(value= "指定库位") |
| | | private String locCode; |
| | | |
| | | public Wave() {} |
| | | |
| | | public Wave(String code,Short type,Short exceStatus,Double anfme,Double qty,Integer orderNum,Integer status,Long tenantId,Date createTime,Long createBy,Date updateTime,Long updateBy,Integer deleted,String memo) { |
| | |
| | | R genOutStock(List<DeliveryItem> ids, Long loginUserId); |
| | | |
| | | R generateWaves(GenWaveParams ids); |
| | | R generateWavesOrderAuto(GenWaveParams ids,String stationId); |
| | | R generateWavesOrderAuto(GenWaveParams ids,String stationId,String locCode); |
| | | |
| | | R saveOutStock(AsnOrderAndItemsParams params, Long loginUserId); |
| | | |
| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R generateWavesOrderAuto(GenWaveParams params,String stationId) { |
| | | public R generateWavesOrderAuto(GenWaveParams params,String stationId,String locCode) { |
| | | if (Objects.isNull(params.getIds()) || params.getIds().isEmpty()) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | |
| | | double sum1 = waveItems.stream().mapToDouble(WaveItem::getAnfme).sum(); |
| | | wave.setAnfme(sum1).setGroupQty(waveItems.size()); |
| | | wave.setStationId(stationId); |
| | | wave.setLocCode(locCode); |
| | | if (!waveService.saveOrUpdate(wave)) { |
| | | throw new CoolException("主单修改失败!!"); |
| | | } |
| | |
| | | .setWaveId(item.getWaveId()); |
| | | params.add(locParams); |
| | | } |
| | | List<OrderOutItemDto> results = LocManageUtil.getOutOrderList(params, null,waves.getStationId()); |
| | | List<OrderOutItemDto> results = LocManageUtil.getOutOrderList(params, null,waves.getStationId(),waves.getLocCode()); |
| | | generateOutTask(results, loginUserId, waves); |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage()); |
| | |
| | | .setWaveId(item.getWaveId()); |
| | | params.add(locParams); |
| | | } |
| | | List<OrderOutItemDto> results = LocManageUtil.getOutOrderList(params, waveRule,wave.getStationId()); |
| | | List<OrderOutItemDto> results = LocManageUtil.getOutOrderList(params, waveRule,wave.getStationId(),wave.getLocCode()); |
| | | if (results.isEmpty()) { |
| | | wave.setUpdateBy(loginUserId).setUpdateTime(new Date()); |
| | | if (wave.getAnfme().compareTo(wave.getWorkQty()) == 0) { |
| | |
| | | * @param waveRule |
| | | * @return |
| | | */ |
| | | public static List<OrderOutItemDto> getOutOrderList(List<WaveToLocParams> params, WaveRule waveRule,String stationId) { |
| | | public static List<OrderOutItemDto> getOutOrderList(List<WaveToLocParams> params, WaveRule waveRule,String stationId,String locCode) { |
| | | LocService locService = SpringUtils.getBean(LocService.class); |
| | | LocItemService locItemService = SpringUtils.getBean(LocItemService.class); |
| | | DeviceSiteService deviceSiteService = SpringUtils.getBean(DeviceSiteService.class); |
| | |
| | | } |
| | | for (LocItem locItem : locItems) { |
| | | Loc loc = locService.getById(locItem.getLocId()); |
| | | if (!Cools.isEmpty(locCode) || !Cools.isEmpty(stationId)) { |
| | | if (!loc.getCode().equals(locCode)){ |
| | | continue; |
| | | } |
| | | } |
| | | List<LocItem> itemList = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocId, loc.getId())); |
| | | |
| | | if (issued.doubleValue() > 0 && locList.contains(loc)) { |