| | |
| | | } |
| | | |
| | | /** |
| | | * 全版出库完结:扣除库位数量,将库位状态设为空 |
| | | * 全板出库完结:扣除库位数量,将库位状态设为空 |
| | | * |
| | | * @param id 任务ID |
| | | * @param loginUserId 登录用户ID |
| | | * @param notifyRcsFromAdmin 管理后台全版出库完结接口为 true 时通知 RCS;定时/PDA 等为 false |
| | | * @param notifyRcsFromAdmin 管理后台全板出库完结接口为 true 时通知 RCS;定时/PDA 等为 false |
| | | * @return 任务对象 |
| | | */ |
| | | @Override |
| | |
| | | throw new CoolException("任务不存在!!"); |
| | | } |
| | | |
| | | // 检查任务类型是否为全版出库 |
| | | // 检查任务类型是否为全板出库 |
| | | if (!task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) { |
| | | throw new CoolException("当前任务不是全版出库任务,无法执行此操作!!"); |
| | | throw new CoolException("当前任务不是全板出库任务,无法执行此操作!!"); |
| | | } |
| | | |
| | | // 检查任务状态:必须是199(WAVE_SEED)状态才能手动完结 |
| | |
| | | .eq(Loc::getCode, task.getOrgLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type))) { |
| | | throw new CoolException("源库位状态修改失败!!"); |
| | | } |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)) { |
| | | // 空板出库:建单时 D→R,取消恢复为空板 D |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getOrgLoc()) |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_R.type) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type))) { |
| | | throw new CoolException("空板出库源库位恢复空板失败!!"); |
| | | } |
| | | } |
| | | |
| | |
| | | try { |
| | | // 根据任务类型更新库位明细 |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) { |
| | | // 全版出库:不删除库位明细,等待PDA快速拣货确认时再删除 |
| | | // 全板出库:不删除库位明细,等待PDA快速拣货确认时再删除 |
| | | // subtractLocItem(loc); // 已移除,改为在completeFullOutStock中删除 |
| | | } else if (!TaskType.TASK_TYPE_PICK_AGAIN_OUT.type.equals(task.getTaskType())) { |
| | | // 部分出库(如盘点出库):根据TaskItem数量扣减库位明细;拣料出库在生成拣料入库单时扣减 |
| | |
| | | // 拣料出库/盘点出库:在未生成拣料入库单之前保持 R.预约出库,否则下发任务时查不到该库位(只查 F+R)导致“库存不足” |
| | | // 等 PDA 确认并生成拣料入库任务时,再在 pickOrCheckTask 中将目标库位改为 S.预约入库 |
| | | } else if (task.getTaskType().equals(TaskType.TASK_TYPE_OUT.type)) { |
| | | // 全版出库:不更新库位状态为O,等待PDA快速拣货确认时再更新 |
| | | // 全板出库:不更新库位状态为O,等待PDA快速拣货确认时再更新 |
| | | // 库位状态保持原样(R.出库预约状态) |
| | | } else { |
| | | /**修改为库位状态为O.空库*/ |
| | |
| | | log.error("========== RCS任务下发失败 =========="); |
| | | log.error("站点不存在!!任务编码:{},目标站点:{}", task.getTaskCode(), task.getTargSite()); |
| | | continue; |
| | | } |
| | | // 出库下发前校验站点状态与出库能力 |
| | | if (task.getTaskType() >= TaskType.TASK_TYPE_OUT.type) { |
| | | if (!Integer.valueOf(1).equals(station.getStatus()) || !Integer.valueOf(1).equals(station.getOutAble())) { |
| | | log.error("========== RCS任务下发失败 =========="); |
| | | log.error("站点不可出库下发!!任务编码:{},目标站点:{},站点状态(status):{},能出(outAble):{}", |
| | | task.getTaskCode(), task.getTargSite(), station.getStatus(), station.getOutAble()); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/5/20 |
| | | * @description: 扣减库存明细(全版出库:删除所有库位明细) |
| | | * @description: 扣减库存明细(全板出库:删除所有库位明细) |
| | | * @version 1.0 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | } |
| | | } |
| | | } |
| | | // 出库仅云仓来源单据参与上报 |
| | | if (!isInbound) { |
| | | boolean hasCloudSource = taskItems.stream().anyMatch(this::hasCloudOrderRef); |
| | | if (!hasCloudSource) { |
| | | // log.info("入/出库结果上报待办跳过:无云仓来源单据,taskId={}", task.getId()); |
| | | log.info("入/出库结果上报待办跳过:手动创建出库单据不通知云仓,taskId={}", task.getId()); |
| | | return; |
| | | } |
| | | } |
| | | ObjectMapper om = new ObjectMapper(); |
| | | Date now = new Date(); |
| | | for (TaskItem item : taskItems) { |
| | | if (!isInbound && !hasCloudOrderRef(item)) { |
| | | continue; |
| | | } |
| | | String orderNo = isInbound ? sourceToOrderNo.get(item.getSource()) : (item.getPlatOrderCode() != null ? item.getPlatOrderCode() : item.getPlatWorkCode()); |
| | | if (orderNo == null && isInbound) { |
| | | orderNo = item.getPlatOrderCode() != null ? item.getPlatOrderCode() : item.getPlatWorkCode(); |
| | |
| | | log.warn("入/出库结果上报待办失败,taskId={},isInbound={}:{}", task.getId(), isInbound, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | private boolean hasCloudOrderRef(TaskItem item) { |
| | | if (item == null) { |
| | | return false; |
| | | } |
| | | return StringUtils.isNotBlank(item.getPlatOrderCode()) |
| | | || StringUtils.isNotBlank(item.getPlatWorkCode()); |
| | | } |
| | | } |