| | |
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 1. 定时拉取需要执行回库任务列表数据,
|
| | | * 2. 删除原始库位明细,原始库位状态置成O.空库
|
| | | * 3.
|
| | | */
|
| | | @Scheduled(cron = "0/3 * * * * ? ")
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void rollbackStock() {
|
| | | //获取需要执行回库的任务,更新库存信息
|
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskType, 53).eq(Task::getTaskSts, TaskStsType.WCS_CONVEYOR_START.id));
|
| | | if (tasks.isEmpty()) {
|
| | | return;
|
| | | }
|
| | | tasks.forEach(task -> {
|
| | | //删除原始库位明细,状态置为O.空库
|
| | | executeTask103(task);
|
| | | });
|
| | | //todo 需添加一个任务状态或临时状态,否则会一直轮循,程序报错(库位状态不处于R.出库预约)
|
| | | }
|
| | |
|
| | |
|
| | | @Scheduled(cron = "0/10 * * * * ? ")
|
| | | @Transactional(rollbackFor = Exception.class)
|
| | | public void outExecute() {
|
| | |
| | | if (!taskService.updateById(task)) {
|
| | | throw new CoolException("库存更新失败");
|
| | | } else {
|
| | | //CacheSite 释放已被占用的通道
|
| | | List<TaskDetl> detls = taskDetlService.list(new LambdaQueryWrapper<TaskDetl>().eq(TaskDetl::getTaskId, task.getId()));
|
| | | if (!Collections.isEmpty(detls)) {
|
| | | List<Long> waveIds = detls.stream().map(TaskDetl::getWaveId).collect(Collectors.toList());
|
| | | List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getWaveId, waveIds));
|
| | | List<Long> orderIds = orders.stream().map(Order::getId).collect(Collectors.toList());
|
| | | cacheSiteService.update(new LambdaUpdateWrapper<CacheSite>()
|
| | | .in(CacheSite::getOrderId, orderIds)
|
| | | .set(CacheSite::getSiteStatus, 0)
|
| | | .set(CacheSite::getOrderId, null)
|
| | | .set(CacheSite::getOrderNo, null));
|
| | | }
|
| | | //CacheSite 释放已被占用的通道 //fixme 播种功能完成后,需要将这里注释掉
|
| | | // List<TaskDetl> detls = taskDetlService.list(new LambdaQueryWrapper<TaskDetl>().eq(TaskDetl::getTaskId, task.getId()));
|
| | | // if (!Collections.isEmpty(detls)) {
|
| | | // List<Long> waveIds = detls.stream().map(TaskDetl::getWaveId).collect(Collectors.toList());
|
| | | // List<Order> orders = orderService.list(new LambdaQueryWrapper<Order>().in(Order::getWaveId, waveIds));
|
| | | // List<Long> orderIds = orders.stream().map(Order::getId).collect(Collectors.toList());
|
| | | // cacheSiteService.update(new LambdaUpdateWrapper<CacheSite>()
|
| | | // .in(CacheSite::getOrderId, orderIds)
|
| | | // .set(CacheSite::getSiteStatus, 0)
|
| | | // .set(CacheSite::getOrderId, null)
|
| | | // .set(CacheSite::getOrderNo, null));
|
| | | // }
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
| | | //入库
|
| | | private void executeTask1(Task task) {
|
| | | Long hostId = task.getHostId();
|
| | | //fixme 暂时关闭HOSTID
|
| | | // Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId));
|
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()));
|
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId));
|
| | | if (loc == null) {
|
| | | log.info("库位不存在" + "=======>" + task.getTargetLoc());
|
| | | throw new CoolException("库位不存在");
|
| | | }
|
| | |
|
| | |
| | | for (WaitPakin waitPakin : waitPakins) {
|
| | | WaitPakinLog waitPakinLog = new WaitPakinLog();
|
| | | waitPakinLog.sync(waitPakin);
|
| | | waitPakinLog.setId(null);
|
| | | if (!waitPakinLogService.save(waitPakinLog)) {
|
| | | throw new CoolException("组托通知档转历史档失败");
|
| | | }
|
| | |
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * 拣料再入库,根据任务目标库位,生成新库存信息
|
| | | * @param task
|
| | | */
|
| | | //拣料再入库
|
| | | private void executeTask53(Task task) {
|
| | | Long hostId = task.getHostId();
|
| | | //fixme
|
| | | //fixme 将任务当前
|
| | | // Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()).eq(Loc::getHostId, hostId));
|
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, task.getTargetLoc()));
|
| | | if (loc == null) {
|