diff --git a/src/main/java/com/gaotao/modules/api/service/impl/WmsMessageServiceImpl.java b/src/main/java/com/gaotao/modules/api/service/impl/WmsMessageServiceImpl.java index 7752a27..1672c1a 100644 --- a/src/main/java/com/gaotao/modules/api/service/impl/WmsMessageServiceImpl.java +++ b/src/main/java/com/gaotao/modules/api/service/impl/WmsMessageServiceImpl.java @@ -332,6 +332,9 @@ public class WmsMessageServiceImpl implements WmsMessageService { case "取走栈板": result = processPalletRemoval(inData); break; + case "异常位处理": + result = processErrorStation(inData); + break; default: throw new RuntimeException("不支持的事务类型:" + inData.getTransTypeDesc()); } @@ -500,6 +503,14 @@ public class WmsMessageServiceImpl implements WmsMessageService { return "取走栈板回调数据已保存,站点已更新为空闲"; } + + + private String processErrorStation(PalletWareHouseData inData){ + String toWarehouseId = BufferZoneConfig.BUFFER_WAREHOUSE_ID.getValue(); + String toLocationId = BufferZoneConfig.BUFFER_LOCATION_ID.getValue(); + saveWcsCallbackTaskWithRemark(inData, toWarehouseId, toLocationId,inData.getRemark()); + return "异常位处理数据已保存。"; + } /** * @Description 站点编码转换(WCS的1099/1093映射为D1/D2)- rqrq @@ -551,6 +562,28 @@ public class WmsMessageServiceImpl implements WmsMessageService { inData.getPalletId(), inData.getTransTypeDesc(), toWarehouseId, toLocationId); } + private void saveWcsCallbackTaskWithRemark(PalletWareHouseData inData, String toWarehouseId, String toLocationId,String remark) { + WcsCallbackTask callbackTask = new WcsCallbackTask(); + callbackTask.setSite(inData.getSite()); + callbackTask.setPalletId(inData.getPalletId()); + callbackTask.setTransTypeDesc(inData.getTransTypeDesc()); + callbackTask.setToWarehouseId(toWarehouseId); + callbackTask.setToLocationId(toLocationId); + callbackTask.setStatus("已录入"); // 等待定时任务处理 - rqrq + callbackTask.setCreatedTime(new Date()); + callbackTask.setRetryCount(0); + callbackTask.setRemark(remark); + callbackTask.setTaskNo(inData.getTaskNo()); + callbackTask.setItemNo(inData.getItemNo()); + callbackTask.setToStation(inData.getToBarcode()); + + // 保存到WCS回调任务表 - rqrq + wcsIntegrationMapper.insertWcsCallbackTask(callbackTask); + + log.info("WCS回调任务已保存 - rqrq:栈板={}, 类型={}, 目标位置={}-{}", + inData.getPalletId(), inData.getTransTypeDesc(), toWarehouseId, toLocationId); + } + @Override @Transactional public String doWareHouseForPallet(WareHouseTransferRequest request) { diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsTaskServiceImpl.java b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsTaskServiceImpl.java index 01b2fe3..9038b9d 100644 --- a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsTaskServiceImpl.java +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/WcsTaskServiceImpl.java @@ -39,16 +39,16 @@ public class WcsTaskServiceImpl implements WcsTaskService { private WcsIntegrationService wcsIntegrationService; @Autowired private WcsIntegrationMapper wcsIntegrationMapper; - + @Autowired private WmsMessageService wmsMessageService; - + @Autowired private WcsApiService wcsApiService; - + @Autowired private AutoTaskService autoTaskService; - + @Autowired private NewIssureMapper newIssureMapper; @Autowired @@ -65,17 +65,17 @@ public class WcsTaskServiceImpl implements WcsTaskService { public void processWcsCallbackTask(WcsCallbackTask callbackTask) { // 判断是否为超时恢复的任务 - rqrq boolean isTimeoutRecovery = "处理中".equals(callbackTask.getStatus()); - + try { if (isTimeoutRecovery) { - log.warn("检测到超时任务,尝试恢复:id={}, palletId={}, transType={}, processStartTime={}, retryCount={}", - callbackTask.getId(), callbackTask.getPalletId(), callbackTask.getTransTypeDesc(), - callbackTask.getProcessStartTime(), callbackTask.getRetryCount()); + log.warn("检测到超时任务,尝试恢复:id={}, palletId={}, transType={}, processStartTime={}, retryCount={}", + callbackTask.getId(), callbackTask.getPalletId(), callbackTask.getTransTypeDesc(), + callbackTask.getProcessStartTime(), callbackTask.getRetryCount()); } else { - log.info("处理WCS回调任务:palletId={}, transType={}, currentStatus={}", - callbackTask.getPalletId(), callbackTask.getTransTypeDesc(), callbackTask.getStatus()); + log.info("处理WCS回调任务:palletId={}, transType={}, currentStatus={}", + callbackTask.getPalletId(), callbackTask.getTransTypeDesc(), callbackTask.getStatus()); } - + // 获取用户名 - rqrq // List orderTasks = wcsIntegrationMapper.findOrderTasksByTaskNo( // callbackTask.getSite(), @@ -85,25 +85,25 @@ public class WcsTaskServiceImpl implements WcsTaskService { // if (orderTasks != null && !orderTasks.isEmpty()) { // userName = orderTasks.get(0).getCreatedBy(); // } - + // 1. 使用乐观锁更新状态为处理中(防止重复处理)- rqrq int updateCount = wcsIntegrationMapper.updateWcsCallbackTaskStatusWithLock( - callbackTask.getId(), - callbackTask.getStatus(), // 原状态(已录入 or 处理失败 or 处理中) - "处理中", - new Date() + callbackTask.getId(), + callbackTask.getStatus(), // 原状态(已录入 or 处理失败 or 处理中) + "处理中", + new Date() ); - + // 2. 如果更新失败,说明已被其他线程处理,直接返回 - rqrq if (updateCount == 0) { - log.warn("任务已被其他线程处理,跳过:id={}, palletId={}, status={}", - callbackTask.getId(), callbackTask.getPalletId(), callbackTask.getStatus()); + log.warn("任务已被其他线程处理,跳过:id={}, palletId={}, status={}", + callbackTask.getId(), callbackTask.getPalletId(), callbackTask.getStatus()); return; // 跳过,不抛异常 } - - log.info("成功锁定任务,开始处理:palletId={}, transType={}, isTimeoutRecovery={}", - callbackTask.getPalletId(), callbackTask.getTransTypeDesc(), isTimeoutRecovery); - + + log.info("成功锁定任务,开始处理:palletId={}, transType={}, isTimeoutRecovery={}", + callbackTask.getPalletId(), callbackTask.getTransTypeDesc(), isTimeoutRecovery); + // 3. 根据不同的TransTypeDesc执行不同的处理逻辑 - rqrq String result = ""; if ("入库".equals(callbackTask.getTransTypeDesc()) || "出库".equals(callbackTask.getTransTypeDesc())) { @@ -114,11 +114,11 @@ public class WcsTaskServiceImpl implements WcsTaskService { // 更新托盘状态 - rqrq if ("入库".equals(callbackTask.getTransTypeDesc())) { updateOrderTaskStatusForInbound(callbackTask); - palletMapper.updateLocationWithPalletId(request.getSite(),request.getPalletId(),request.getToStation(),request.getToStation()); + palletMapper.updateLocationWithPalletId(request.getSite(), request.getPalletId(), request.getToStation(), request.getToStation()); wcsIntegrationMapper.updatePalletCallingFlag(callbackTask.getSite(), callbackTask.getPalletId(), "N", "SYS_WMS"); } else { - palletMapper.updateLocationWithPalletId(request.getSite(),request.getPalletId(),"Virtual_AS",null); + palletMapper.updateLocationWithPalletId(request.getSite(), request.getPalletId(), "Virtual_AS", null); // wcsIntegrationMapper.updatePalletWcsLocation(callbackTask.getSite(), callbackTask.getPalletId(), null); wcsIntegrationMapper.updatePalletCallingFlag(callbackTask.getSite(), callbackTask.getPalletId(), "Y", "SYS_WMS"); @@ -129,34 +129,37 @@ public class WcsTaskServiceImpl implements WcsTaskService { } else if ("取走栈板".equals(callbackTask.getTransTypeDesc())) { // 取走栈板:更新站点状态 - rqrq result = processPalletRemoval(callbackTask); + } else if ("异常位处理".equals(callbackTask.getTransTypeDesc())) { + // 取走栈板:更新站点状态 - rqrq + result = processErrorStation(callbackTask); } else { throw new RuntimeException("不支持的事务类型:" + callbackTask.getTransTypeDesc()); } - - log.info("WCS回调任务处理成功:palletId={}, transType={}, result={}", - callbackTask.getPalletId(), callbackTask.getTransTypeDesc(), result); - + + log.info("WCS回调任务处理成功:palletId={}, transType={}, result={}", + callbackTask.getPalletId(), callbackTask.getTransTypeDesc(), result); + // 6. 更新任务状态为已完成 - rqrq wcsIntegrationMapper.updateWcsCallbackTaskStatus(callbackTask.getId(), "已完成", null, new Date(), null); - + } catch (Exception e) { - log.error("处理WCS回调任务失败:palletId={}, transType={}, isTimeoutRecovery={}", - callbackTask.getPalletId(), callbackTask.getTransTypeDesc(), isTimeoutRecovery, e); - + log.error("处理WCS回调任务失败:palletId={}, transType={}, isTimeoutRecovery={}", + callbackTask.getPalletId(), callbackTask.getTransTypeDesc(), isTimeoutRecovery, e); + // 更新重试次数(超时恢复的任务也算作一次重试)- rqrq int currentRetryCount = (callbackTask.getRetryCount() == null ? 0 : callbackTask.getRetryCount()); int newRetryCount = isTimeoutRecovery ? currentRetryCount + 1 : currentRetryCount + 1; String status = newRetryCount >= 3 ? "处理失败" : "已录入"; // 重试3次后标记为失败 - + String errorMsg = (isTimeoutRecovery ? "[超时恢复]" : "") + e.getMessage(); - - log.warn("任务处理失败,更新状态:id={}, retryCount={}->{}, status={}", - callbackTask.getId(), currentRetryCount, newRetryCount, status); - + + log.warn("任务处理失败,更新状态:id={}, retryCount={}->{}, status={}", + callbackTask.getId(), currentRetryCount, newRetryCount, status); + // 更新失败状态到日志表 - rqrq wcsIntegrationMapper.updateWcsCallbackTaskStatus(callbackTask.getId(), status, null, null, errorMsg); wcsIntegrationMapper.updateWcsCallbackTaskRetryCount(callbackTask.getId(), newRetryCount); - + throw new RuntimeException("处理WCS回调任务失败: " + e.getMessage(), e); } } @@ -171,7 +174,7 @@ public class WcsTaskServiceImpl implements WcsTaskService { public void processWcsPalletOutTask(WmsOrderTask orderTask) { try { log.info("处理立库调栈板任务:taskNo={}, palletId={}", orderTask.getTaskNo(), orderTask.getPalletId()); - + // 1. 检查重试次数,避免无限重试 int currentRetryCount = getCurrentRetryCount(orderTask); if (currentRetryCount >= 3) { @@ -179,29 +182,29 @@ public class WcsTaskServiceImpl implements WcsTaskService { wcsIntegrationMapper.updateOrderTaskStatusAndWmsStatus(orderTask.getId(), "处理失败", "重试次数超限"); return; } - + // 2. 更新状态为处理中 wcsIntegrationMapper.updateOrderTaskStatusAndWmsStatus(orderTask.getId(), "处理中", "调用WCS中"); - + // 3. 调用WCS出库方法 String result = callPalletOutWcs(orderTask); - + log.info("立库调栈板任务处理成功:taskNo={}, result={}", orderTask.getTaskNo(), result); - + // 4. 更新任务状态为已完成 wcsIntegrationMapper.updateOrderTaskStatusAndWmsStatus(orderTask.getId(), "已下达", "WCS调用成功"); - + } catch (Exception e) { log.error("处理立库调栈板任务失败:taskNo={}, error={}", orderTask.getTaskNo(), e.getMessage()); - + // 更新重试次数和错误信息 int newRetryCount = getCurrentRetryCount(orderTask) + 1; String status = newRetryCount >= 3 ? "处理失败" : "已创建"; // 重试3次后标记为失败 String wmsStatus = newRetryCount >= 3 ? "重试次数超限" : "等待重试"; - + wcsIntegrationMapper.updateOrderTaskStatusAndWmsStatus(orderTask.getId(), status, wmsStatus); wcsIntegrationMapper.updateOrderTaskErrorInfo(orderTask.getId(), "WCS_CALL_ERROR", e.getMessage()); - + throw new RuntimeException("处理立库调栈板任务失败: " + e.getMessage(), e); } } @@ -209,7 +212,7 @@ public class WcsTaskServiceImpl implements WcsTaskService { @Override public WareHouseTransferRequest buildWareHouseTransferRequest(WcsCallbackTask callbackTask) { WareHouseTransferRequest request = new WareHouseTransferRequest(); - + // 从回调任务中获取基本信息 - rqrq request.setSite(callbackTask.getSite()); request.setPalletId(callbackTask.getPalletId()); @@ -217,7 +220,7 @@ public class WcsTaskServiceImpl implements WcsTaskService { request.setToLocationId(callbackTask.getToLocationId()); request.setTransType("移库"); request.setToStation(callbackTask.getToStation()); // 立库内的站点都为* - + // 根据transTypeDesc判断业务类型 - rqrq if ("入库".equals(callbackTask.getTransTypeDesc())) { request.setBusinessType("立库入库"); @@ -236,12 +239,13 @@ public class WcsTaskServiceImpl implements WcsTaskService { } else { throw new RuntimeException("不支持的事务类型:" + callbackTask.getTransTypeDesc()); } - + return request; } /** * 更新入库对应的订单任务状态 + * * @param callbackTask WCS回调任务 */ private void updateOrderTaskStatusForInbound(WcsCallbackTask callbackTask) { @@ -251,47 +255,48 @@ public class WcsTaskServiceImpl implements WcsTaskService { callbackTask.getSite(), callbackTask.getTaskNo() ); - + if (orderTasks != null && !orderTasks.isEmpty()) { for (WmsOrderTask orderTask : orderTasks) { // 更新wms_order_task的status为已完成,wms_status为已完成 wcsIntegrationMapper.updateOrderTaskStatusAndWmsStatus( - orderTask.getId(), "已完成", "已完成" + orderTask.getId(), "已完成", "已完成" ); - + // 更新对应的wms_order_task_detail状态为已完成 wcsIntegrationMapper.updateOrderTaskDetailStatusByTaskNo( - orderTask.getTaskNo(), "已完成", "已完成" + orderTask.getTaskNo(), "已完成", "已完成" ); - - log.info("已更新订单任务状态:taskNo={}, palletId={}", - orderTask.getTaskNo(), callbackTask.getPalletId()); + + log.info("已更新订单任务状态:taskNo={}, palletId={}", + orderTask.getTaskNo(), callbackTask.getPalletId()); } } else { log.warn("未找到对应的组盘入库订单任务:palletId={}", callbackTask.getPalletId()); } - + } catch (Exception e) { - log.error("更新订单任务状态失败:palletId={}, error={}", - callbackTask.getPalletId(), e.getMessage()); + log.error("更新订单任务状态失败:palletId={}, error={}", + callbackTask.getPalletId(), e.getMessage()); // 不抛出异常,避免影响主流程 } } /** * 调用WCS出库方法 + * * @param orderTask 订单任务 * @return 调用结果 */ private String callPalletOutWcs(WmsOrderTask orderTask) { try { // 调用具体的WCS出库接口 - log.info("调用WCS出库接口:taskNo={}, palletId={}, fromLocation={}, toLocation={}", - orderTask.getTaskNo(), orderTask.getPalletId(), orderTask.getFromLocation(), orderTask.getToLocation()); - + log.info("调用WCS出库接口:taskNo={}, palletId={}, fromLocation={}, toLocation={}", + orderTask.getTaskNo(), orderTask.getPalletId(), orderTask.getFromLocation(), orderTask.getToLocation()); + wcsApiService.pushWCSTaskApi(orderTask); return "WCS出库调用成功"; - + } catch (Exception e) { log.error("调用WCS出库接口失败:taskNo={}, error={}", orderTask.getTaskNo(), e.getMessage()); throw new RuntimeException("WCS出库调用失败:" + e.getMessage()); @@ -300,6 +305,7 @@ public class WcsTaskServiceImpl implements WcsTaskService { /** * 获取当前任务的重试次数 + * * @param orderTask 订单任务 * @return 重试次数 */ @@ -319,9 +325,9 @@ public class WcsTaskServiceImpl implements WcsTaskService { } /** - * @Description 处理取货通知 - rqrq * @param callbackTask WCS回调任务 * @return 处理结果 + * @Description 处理取货通知 - rqrq * @author rqrq * @date 2025/10/24 */ @@ -341,12 +347,12 @@ public class WcsTaskServiceImpl implements WcsTaskService { if (callbackTask.getTaskNo() != null && callbackTask.getItemNo() != null) { WmsOrderTask orderTask = wcsIntegrationMapper.findOrderTasksByTaskNoItem( callbackTask.getSite(), callbackTask.getTaskNo(), callbackTask.getItemNo()); - if (orderTask == null){ + if (orderTask == null) { return "取货通知处理成功"; } - if ( !"领料申请单".equals(orderTask.getSourceType()) && !"发货通知单".equals(orderTask.getSourceType())) { + if (!"领料申请单".equals(orderTask.getSourceType()) && !"发货通知单".equals(orderTask.getSourceType())) { wcsIntegrationMapper.updateOrderTaskStatusAndWmsStatus( orderTask.getId(), "已完成", "已完成"); wcsIntegrationMapper.updateOrderTaskDetailStatusByTaskNoPalletId( @@ -365,27 +371,27 @@ public class WcsTaskServiceImpl implements WcsTaskService { callbackTask.getSite(), callbackTask.getPalletId()); if (checkIfHasNeedTask == null) { - System.out.println("栈板{}没有预约任务,检查是否有预留物料 - rqrq"+callbackTask.getPalletId()); - + System.out.println("栈板{}没有预约任务,检查是否有预留物料 - rqrq" + callbackTask.getPalletId()); + // 获取栈板明细 - rqrq List palletDetailList = wcsIntegrationMapper.getPalletDetailsData( callbackTask.getSite(), callbackTask.getPalletId()); - + boolean hasReservePart = false; if (palletDetailList != null && !palletDetailList.isEmpty()) { // 收集所有序列号 - rqrq List serialNos = palletDetailList.stream() .map(PalletDetailData::getSerialNo) .collect(Collectors.toList()); - + // 查询handling_unit的reserve_order_ref信息 - rqrq - List reserveInfoList = + List reserveInfoList = wcsIntegrationMapper.getReserveOrderRefsBySerialNos(callbackTask.getSite(), serialNos); - + // 检查是否有预留物料(reserve_flag='Y'或reserve_order_ref1不为空)- rqrq hasReservePart = reserveInfoList.stream() .anyMatch(r -> r.getReserveOrderRef1() != null && !r.getReserveOrderRef1().isEmpty()); - + if (hasReservePart) { deliveryTaskService.createDeliveryTaskByPallet(callbackTask.getSite(), callbackTask.getPalletId()); // try { @@ -439,24 +445,24 @@ public class WcsTaskServiceImpl implements WcsTaskService { // 更新SOIssueNotifyOrderMaterialList_detail的out_wcs_flag以及wms_order_task状态 - rqrq try { log.info("开始批量更新栈板{}的申请单和任务状态 - rqrq", callbackTask.getPalletId()); - + // 1. 收集所有序列号(已在369行收集)- rqrq log.info("收集到序列号数量:{} - rqrq", serialNos.size()); - + // 2. 根据序列号列表查询SOIssueNotifyOrderMaterialList_detail明细 - rqrq - List notifyDetails = - wcsIntegrationMapper.getSOIssueNotifyDetailsBySerialNos(callbackTask.getSite(), serialNos); + List notifyDetails = + wcsIntegrationMapper.getSOIssueNotifyDetailsBySerialNos(callbackTask.getSite(), serialNos); log.info("查询到申请单明细数量:{} - rqrq", notifyDetails.size()); - - // 3. 批量更新out_wcs_flag为Y(性能优化:一次UPDATE替代N次)- rqrq + + // 3. 批量更新out_wcs_flag为Y(性能优化:一次UPDATE替代N次)- rqrq if (!notifyDetails.isEmpty()) { List serialNosToUpdate = notifyDetails.stream() - .map(com.gaotao.modules.notify.entity.SOIssueNotifyOrderMaterialListDetail::getSerialNo) - .collect(Collectors.toList()); + .map(com.gaotao.modules.notify.entity.SOIssueNotifyOrderMaterialListDetail::getSerialNo) + .collect(Collectors.toList()); wcsIntegrationMapper.batchUpdateSOIssueNotifyDetailOutWcsFlag(callbackTask.getSite(), serialNosToUpdate); log.info("批量更新{}个序列号的out_wcs_flag为Y - rqrq", serialNosToUpdate.size()); } - + // 4. 收集需要更新的任务明细(去重task_ref+task_item+task_seq)- rqrq List taskDetailsToUpdate = new ArrayList<>(); for (com.gaotao.modules.notify.entity.SOIssueNotifyOrderMaterialListDetail notifyDetail : notifyDetails) { @@ -465,42 +471,42 @@ public class WcsTaskServiceImpl implements WcsTaskService { log.debug("跳过task_seq为0或null的记录,序列号={} - rqrq", notifyDetail.getSerialNo()); continue; } - + taskDetailsToUpdate.add(new com.gaotao.modules.automatedWarehouse.entity.TaskDetailKey( - notifyDetail.getTaskRef(), - notifyDetail.getTaskItem(), - notifyDetail.getTaskSeq() + notifyDetail.getTaskRef(), + notifyDetail.getTaskItem(), + notifyDetail.getTaskSeq() )); } - + // 5. 批量更新wms_order_task_detail状态(性能优化:一次UPDATE替代N次)- rqrq if (!taskDetailsToUpdate.isEmpty()) { wcsIntegrationMapper.batchUpdateWmsOrderTaskDetailStatus(callbackTask.getSite(), taskDetailsToUpdate); log.info("批量更新{}个任务明细状态为已完成/直接出库 - rqrq", taskDetailsToUpdate.size()); } - + // 6. 收集涉及的taskNo+itemNo组合(去重)- rqrq List taskKeysToCheck = taskDetailsToUpdate.stream() - .map(detail -> new com.gaotao.modules.automatedWarehouse.entity.TaskDetailKey( - detail.getTaskNo(), detail.getItemNo())) - .distinct() - .collect(Collectors.toList()); - + .map(detail -> new com.gaotao.modules.automatedWarehouse.entity.TaskDetailKey( + detail.getTaskNo(), detail.getItemNo())) + .distinct() + .collect(Collectors.toList()); + // 7. 批量更新所有已完成任务的主表状态(性能优化:一次UPDATE替代N次SELECT+UPDATE)- rqrq if (!taskKeysToCheck.isEmpty()) { wcsIntegrationMapper.batchUpdateCompletedTaskStatus(callbackTask.getSite(), taskKeysToCheck); log.info("批量检查并更新{}个任务主表状态为已完成 - rqrq", taskKeysToCheck.size()); } - + log.info("批量更新栈板{}的申请单和任务状态完成 - rqrq", callbackTask.getPalletId()); - + } catch (Exception ex) { // 更新任务状态失败不影响主流程,只打印日志 - rqrq log.error("更新栈板{}的任务状态失败 - rqrq:{}", callbackTask.getPalletId(), ex.getMessage()); ex.printStackTrace(); } } else { - System.out.println("栈板{}无预留物料,不创建配送任务 - rqrq"+callbackTask.getPalletId()); + System.out.println("栈板{}无预留物料,不创建配送任务 - rqrq" + callbackTask.getPalletId()); } } } else { @@ -508,10 +514,10 @@ public class WcsTaskServiceImpl implements WcsTaskService { } } - + System.out.println("处理取货通知完成 - rqrq,palletId=" + callbackTask.getPalletId()); return "取货通知处理成功"; - + } catch (Exception e) { System.err.println("处理取货通知失败 - rqrq:" + e.getMessage()); throw new RuntimeException("处理取货通知失败: " + e.getMessage(), e); @@ -519,31 +525,45 @@ public class WcsTaskServiceImpl implements WcsTaskService { } /** - * @Description 处理取走栈板 - rqrq * @param callbackTask WCS回调任务 * @return 处理结果 + * @Description 处理取走栈板 - rqrq * @author rqrq * @date 2025/10/24 */ private String processPalletRemoval(WcsCallbackTask callbackTask) { System.out.println("开始处理取走栈板 - rqrq,palletId=" + callbackTask.getPalletId() + ", toStation=" + callbackTask.getToStation()); - + try { // 1. 检查toStation是否以D开头(滚筒对接区)- rqrq if (callbackTask.getToStation() == null || !callbackTask.getToStation().startsWith("D")) { throw new RuntimeException("目前只有滚筒对接区(D1/D2)可以执行取走栈板操作,当前站点:" + callbackTask.getToStation()); } - + // 2. 更新站点状态为空闲 - rqrq // wcsIntegrationMapper.updateAgvStationStatus(callbackTask.getToStation(), 0, "空闲"); - + System.out.println("处理取走栈板完成 - rqrq,palletId=" + callbackTask.getPalletId() + ", 站点" + callbackTask.getToStation() + "已更新为空闲"); return "取走栈板处理成功,站点已更新为空闲"; - + } catch (Exception e) { System.err.println("处理取走栈板失败 - rqrq:" + e.getMessage()); throw new RuntimeException("处理取走栈板失败: " + e.getMessage(), e); } } -} \ No newline at end of file + private String processErrorStation(WcsCallbackTask callbackTask) { + System.out.println("开始处理取走栈板 - rqrq,palletId=" + callbackTask.getPalletId() + ", toStation=" + callbackTask.getToStation()); + int rows = palletMapper.updatePalletToErrorStatus( + callbackTask.getSite(), + callbackTask.getPalletId(), + callbackTask.getToStation() + ); + + log.info("更新托盘为异常状态 - rqrq,site={},palletId={},异常处理位={}", + callbackTask.getSite(), + callbackTask.getPalletId(), + callbackTask.getToStation()); + return "异常位处理成功"; + } +} \ No newline at end of file