| | |
| | | import com.vincent.rsf.server.system.service.impl.FieldsItemServiceImpl; |
| | | import com.vincent.rsf.server.system.service.impl.FieldsServiceImpl; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import com.vincent.rsf.server.common.constant.Constants; |
| | | import com.vincent.rsf.server.system.utils.SystemAuthUtils; |
| | | import lombok.Synchronized; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Synchronized |
| | | public R saveOutTaskSts(String barcode) { |
| | | LambdaQueryWrapper<Task> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | lambdaQueryWrapper.eq(Task::getBarcode, barcode); |
| | |
| | | if (!task.getTaskStatus().equals(TaskStsType.WAVE_SEED.id)) { |
| | | return R.error("任务状态不是等待确认"); |
| | | } |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); |
| | | Map<Long, List<TaskItem>> maps = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getSource)); |
| | | maps.keySet().forEach(key -> { |
| | | WkOrderItem orderItem = asnOrderItemService.getById(key); |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | | } |
| | | }); |
| | | task.setTaskStatus(TaskStsType.COMPLETE_OUT.id); |
| | | if (!taskService.updateById(task)) { |
| | | return R.error("更新任务状态失败"); |
| | | |
| | | Long loginUserId = SystemAuthUtils.getLoginUserId(); |
| | | if (loginUserId == null) { |
| | | loginUserId = 1L; // 使用默认值 |
| | | } |
| | | |
| | | return R.ok("确认成功"); |
| | | |
| | | try { |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) { |
| | | // 拣料出库:创建拣料入库任务(形成闭环) |
| | | taskService.pickOrCheckTask(task.getId(), ""); |
| | | return R.ok("确认成功,已创建拣料入库任务"); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { |
| | | // 盘点出库:创建盘点入库任务(形成闭环) |
| | | taskService.pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK); |
| | | return R.ok("确认成功,已创建盘点入库任务"); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) { |
| | | // 全版出库:更新为200(最终完成,不闭环) |
| | | taskService.completeFullOutStock(task.getId(), loginUserId); |
| | | return R.ok("确认成功,全版出库已完成"); |
| | | } else { |
| | | // 其他出库类型:直接更新为200 |
| | | task.setTaskStatus(TaskStsType.UPDATED_OUT.id) |
| | | .setUpdateBy(loginUserId) |
| | | .setUpdateTime(new Date()); |
| | | if (!taskService.updateById(task)) { |
| | | return R.error("更新任务状态失败"); |
| | | } |
| | | return R.ok("确认成功"); |
| | | } |
| | | } catch (Exception e) { |
| | | throw new CoolException("快速拣货确认失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | |
| | | try { |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type)) { |
| | | // 拣料出库:创建拣料入库任务 |
| | | taskService.pickOrCheckTask(task.getId(), ""); |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type)) { |
| | | // 盘点出库:创建盘点入库任务 |
| | | taskService.pickOrCheckTask(task.getId(), Constants.TASK_TYPE_OUT_CHECK); |
| | | } else { |
| | | // 其他出库类型:直接更新为200 |
| | | task.setTaskStatus(TaskStsType.UPDATED_OUT.id); |
| | | if (!taskService.updateById(task)) { |
| | | throw new CoolException("任务状态更新失败"); |