| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static com.vincent.rsf.server.system.utils.SystemAuthUtils.getLoginUserId; |
| | | |
| | |
| | | * @version 1.0 |
| | | */ |
| | | @Scheduled(cron = "0/35 * * * * ?") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void autoCheckComplete() { |
| | | Boolean autoRunArea = configService.getVal("AUTO_RUN_CHECK_ORDERS", Boolean.class); |
| | | if (!autoRunArea) { |
| | |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() |
| | | .in(Task::getTaskType, Arrays.asList(TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_CHECK_IN.type))); |
| | | |
| | | if (tasks.size() >= 5) { |
| | | return; |
| | | } |
| | | if (!tasks.isEmpty()) { |
| | | tasks.forEach(task -> { |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { |
| | | if (task.getTaskStatus().equals(TaskStsType.COMPLETE_IN.id)) { |
| | | if (!stationService.update(new LambdaUpdateWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getOrgSite()) |
| | | .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) { |
| | | throw new CoolException("站点状态修改失败!!"); |
| | | } |
| | | |
| | | } |
| | | } else { |
| | | //创建出库任务状态 |
| | | // if (task.getTaskStatus().equals(TaskStsType.WCS_EXECUTE_OUT.id)) { |
| | | // task.setTaskStatus(TaskStsType.COMPLETE_OUT.id); |
| | | // if (!taskService.updateById(task)) { |
| | | // throw new CoolException("盘点出库任务完成失败!!"); |
| | | // } |
| | | // //出库已完成,等待盘点中 |
| | | // } else |
| | | |
| | | if (task.getTaskStatus().equals(TaskStsType.WAVE_SEED.id)) { |
| | | if (!stationService.update(new LambdaUpdateWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getOrgSite()) |
| | | .eq(BasStation::getStationName, task.getTargSite()) |
| | | .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_F.type))) { |
| | | throw new CoolException("站点状态修改失败!!"); |
| | | } |
| | |
| | | taskService.pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK); |
| | | |
| | | if (!stationService.update(new LambdaUpdateWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getOrgSite()) |
| | | .eq(BasStation::getStationName, task.getTargSite()) |
| | | .set(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type))) { |
| | | throw new CoolException("站点状态修改失败!!"); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | log.error("error====>", e); |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/9/1 |
| | | * @description: 自动完成盘点功能 |
| | | * @description: 自动生成任务 |
| | | * @version 1.0 |
| | | */ |
| | | @Scheduled(cron = "0/25 * * * * ?") |
| | |
| | | locItems.forEach(locItem -> { |
| | | locItem.setOutQty(locItem.getAnfme()); |
| | | }); |
| | | List<BasStation> stations = stationService.list(new LambdaQueryWrapper<BasStation>().eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)); |
| | | List<BasStation> stations = stationService.list(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStatus, 1) |
| | | .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_O.type)); |
| | | List<String> stationNames = stations.stream().map(BasStation::getStationName).collect(Collectors.toList()); |
| | | if (Cools.isEmpty(stations)) { |
| | | throw new CoolException("无可用站点!!"); |
| | | } |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .in(DeviceSite::getSite, stations) |
| | | .in(DeviceSite::getSite, stationNames) |
| | | .eq(DeviceSite::getType, TaskType.TASK_TYPE_CHECK_OUT.type), false); |
| | | if (Cools.isEmpty(deviceSite)) { |
| | | throw new CoolException("无可用路径!!"); |