| | |
| | | |
| | | Loc orgLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getOrgLoc())); |
| | | if (Objects.isNull(orgLoc)) { |
| | | throw new CoolException("目标库位不存在!"); |
| | | throw new CoolException("源库位不存在!"); |
| | | } |
| | | |
| | | if (!loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type)) { |
| | |
| | | // throw new CoolException(e.getMessage()); |
| | | // } |
| | | /**修改库位状态为F.在库*/ |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type).eq(Loc::getCode, task.getTargLoc()))) { |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getBarcode, task.getBarcode()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) |
| | | .eq(Loc::getCode, task.getTargLoc()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type).eq(Loc::getCode, task.getOrgLoc()))) { |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .set(Loc::getBarcode, null) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type).eq(Loc::getCode, task.getOrgLoc()))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | |
| | | if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, task.getOrgLoc()))) { |
| | | throw new CoolException("源库位明细删除失败!"); |
| | | } |
| | | |
| | | if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()).set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) { |
| | |
| | | throw new CoolException("数据错误,作业中库存数据丢失!!"); |
| | | } |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { |
| | | locWorking.setWorkQty(0.0); |
| | | locWorking.setAnfme(taskItem.getAnfme()); |
| | | } else { |
| | | if (locWorking.getAnfme().compareTo(taskItem.getAnfme()) >= 0) { |
| | | locWorking.setWorkQty(0.0); |
| | | locWorking.setAnfme(Math.round((locWorking.getAnfme() - taskItem.getAnfme()) * 10000) / 10000.0); |
| | | } else { |
| | | continue; |
| | | } |
| | | } |
| | | BeanUtils.copyProperties(locWorking, locItem); |
| | | locItem.setLocCode(loc.getCode()).setLocId(loc.getId()).setId(null); |
| | | locItem.setWorkQty(0.0).setLocCode(loc.getCode()).setLocId(loc.getId()).setId(null); |
| | | items.add(locItem); |
| | | } |
| | | |
| | |
| | | //保存入出库流水 |
| | | saveStockItems(taskItems, task, null, null, taskItem.getWkType(), taskItem.getOrderType()); |
| | | |
| | | |
| | | if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) { |
| | | throw new CoolException("作业中库存删除失败!!"); |
| | | } |
| | | |
| | | task.setTaskStatus(TaskStsType.UPDATED_IN.id); |
| | | |
| | | task.setTaskStatus(TaskStsType.UPDATED_IN.id).setUpdateTime(null); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | |
| | | @Override |
| | | public R removeTask(Long[] ids) { |
| | | List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); |
| | | List<Task> tasks = this.list(new LambdaQueryWrapper<Task>().in(Task::getId, ids).in(Task::getTaskStatus, longs)); |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type); |
| | | List<Task> tasks = this.list(new LambdaQueryWrapper<Task>() |
| | | .in(Task::getTaskType, list) |
| | | .in(Task::getId, ids).in(Task::getTaskStatus, longs)); |
| | | if (tasks.isEmpty()) { |
| | | throw new CoolException("任务已处执行状态不可取消!!"); |
| | | } |
| | |
| | | } |
| | | |
| | | //全板出库,删除临时库存 |
| | | if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) { |
| | | throw new CoolException("临时库存清除失败!!"); |
| | | } |
| | | if (!locItemWorkingService.remove(new LambdaQueryWrapper<LocItemWorking>().eq(LocItemWorking::getTaskId, task.getId()))) { |
| | | throw new CoolException("临时库存清除失败!!"); |
| | | } |
| | | |
| | | } |
| | | |
| | |
| | | List<TaskItem> items = orderMap.get(key); |
| | | try { |
| | | //保存库存明细 |
| | | saveStockItems(items, task, pakinItem.getId(), pakinItem.getAsnCode(), pakinItem.getWkType(), pakinItem.getType()); |
| | | saveStockItems(items, task, pakinItem.getId(), pakinItem.getAsnCode(), pakinItem.getWkType(), pakinItem.getType()); |
| | | //移出收货区库存, 修改组托状态 |
| | | removeReceiptStock(pakinItem); |
| | | } catch (Exception e) { |
| | |
| | | task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_IN.type) || |
| | | task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type) || |
| | | task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type) || |
| | | task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type) ) { |
| | | task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) { |
| | | stock.setLocCode(task.getTargLoc()); |
| | | } else { |
| | | stock.setLocCode(task.getOrgLoc()); |