From f007d527de8a8c220017252185aed33e8bbe9e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B8=B8=E7=86=9F=E5=90=B4=E5=BD=A6=E7=A5=96?= Date: Wed, 1 Oct 2025 18:17:33 +0800 Subject: [PATCH] =?UTF-8?q?pda=E5=85=A5=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/WmsMessageServiceImpl.java | 47 +++++++++++-------- .../mapper/WcsIntegrationMapper.java | 8 +++- .../service/impl/WcsTaskServiceImpl.java | 11 ++--- .../impl/InventoryMoveServiceImpl.java | 1 + .../WcsIntegrationMapper.xml | 17 ++++++- 5 files changed, 55 insertions(+), 29 deletions(-) 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 12fddc8..4afeaaa 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 @@ -11,6 +11,8 @@ import com.gaotao.modules.automatedWarehouse.entity.WcsCallbackTask; import com.gaotao.modules.automatedWarehouse.entity.WmsOrderTask; import com.gaotao.modules.automatedWarehouse.mapper.WcsIntegrationMapper; import com.gaotao.modules.automatedWarehouse.service.WcsIntegrationService; +import com.gaotao.modules.other.entity.InventoryMoveRequestDto; +import com.gaotao.modules.other.service.InventoryMoveService; import com.gaotao.modules.trans.entity.TransNoControl; import com.gaotao.modules.trans.service.TransNoControlService; import com.gaotao.modules.handlingunit.entity.HandlingUnit; @@ -86,7 +88,8 @@ public class WmsMessageServiceImpl implements WmsMessageService { @Autowired private InventoryStockMapper inventoryStockMapper; - + @Autowired + private InventoryMoveService inventoryMoveService; // 消息队列名称常量 private static final String INBOUND_FINISH_QUEUE = "wms:queue:inbound:finish"; private static final String ROBOT_PICKING_QUEUE = "wms:queue:robot:picking"; @@ -235,26 +238,28 @@ public class WmsMessageServiceImpl implements WmsMessageService { String fromWarehouseId; String fromLocationId; //如果是*说明在立库里,需要查询里面料的当前位置 - if(currentStation.getLocationCode().equals("*")){ - List palletDetail2 = getPalletDetails(request.getSite(), request.getPalletId()); - List checkPart= handlingUnitService.getHandlingUnitsBySiteAndUnid(palletDetail2.getFirst().getSite(),palletDetail2.getFirst().getSerialNo()); - if(checkPart.size()==0){ - throw new RuntimeException("栈板明细列表的条码号在WMS不存在,数据有问题"); - } - fromWarehouseId = checkPart.getFirst().getWarehouseId(); - fromLocationId = checkPart.getFirst().getLocationId(); - }else { + // if(currentStation.getLocationCode().equals("*")){ + // List palletDetail2 = getPalletDetails(request.getSite(), request.getPalletId()); + // List checkPart= handlingUnitService.getHandlingUnitsBySiteAndUnid(palletDetail2.getFirst().getSite(),palletDetail2.getFirst().getSerialNo()); + // if(checkPart.size()==0){ + // throw new RuntimeException("栈板明细列表的条码号在WMS不存在,数据有问题"); + // } + // fromWarehouseId = checkPart.getFirst().getWarehouseId(); + // fromLocationId = checkPart.getFirst().getLocationId(); + // }else { fromWarehouseId = currentStation.getWarehouseCode(); fromLocationId = currentStation.getLocationCode(); + // } + if(fromWarehouseId.equals(request.getToWarehouseId())&&fromLocationId.equals(request.getToLocationId())){ + return "托盘无需执行移库操作:" + request.getPalletId(); } - // 4. 查询托盘上的条码信息 // 需要通过其他方式查询PalletDetail,可能需要创建对应的Service List palletDetails = getPalletDetails(request.getSite(), request.getPalletId()); if (palletDetails.isEmpty()) { - throw new RuntimeException("托盘上无条码信息:" + request.getPalletId()); + return "托盘无条码信息,无需执行移库操作:" ; } // 5. 获取条码对应的HandlingUnit信息 @@ -348,22 +353,24 @@ public class WmsMessageServiceImpl implements WmsMessageService { handlingUnitService.updateById(hu); } - // 11. 更新托盘位置信息 - // 需要查询目标站点 - // AgvStation targetStation = getAgvStationByWarehouseAndLocation( - // request.getToWarehouseId(), request.getToLocationId()); - //------------------------------------------------------------------- - // if (targetStation != null) { + pallet.setLocationCode(request.getToStation()); palletService.updateById(pallet); - // } + String result = "移库操作完成,出库事务号:" + stoTransNo + ",入库事务号:" + stiTransNo; log.info("托盘移库操作完成,托盘ID: {}, 出库事务号: {}, 入库事务号: {}", request.getPalletId(), stoTransNo, stiTransNo); - + + // 11. IFS移库 + InventoryMoveRequestDto ifsRequest = new InventoryMoveRequestDto(); + ifsRequest.setSite("55"); + ifsRequest.setTargetLocationId(request.getToLocationId()); + List handlingUnitIds = handlingUnits.stream() + .map(HandlingUnit::getUnitId).collect(Collectors.toList()); + ifsRequest.setHandlingUnitIds(handlingUnitIds); return result; } catch (Exception e) { diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java b/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java index 91e94b9..61dfe7f 100644 --- a/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/mapper/WcsIntegrationMapper.java @@ -242,11 +242,15 @@ public interface WcsIntegrationMapper { /** * 根据栈板ID和动作类型查找订单任务 - AI制作 */ - List findOrderTasksByPalletAndActionType(@Param("site") String site, + List findOrderTasksByPalletAndActionType(@Param("site") String site, @Param("palletId") String palletId, @Param("sourceType") String sourceType, @Param("status") String status); - + + List findOrderTasksByTaskNo(@Param("site") String site, + @Param("taskNo") String taskNo); + + /** * 更新订单任务状态和WMS状态 - AI制作 */ 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 04f05b2..3722b8a 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 @@ -2,6 +2,7 @@ package com.gaotao.modules.automatedWarehouse.service.impl; import com.gaotao.modules.api.entity.WareHouseTransferRequest; import com.gaotao.modules.api.service.WcsApiService; + import com.gaotao.modules.api.service.WmsMessageService; import com.gaotao.modules.automatedWarehouse.entity.WcsCallbackTask; import com.gaotao.modules.automatedWarehouse.entity.WmsOrderTask; @@ -132,7 +133,7 @@ public class WcsTaskServiceImpl implements WcsTaskService { request.setToWarehouseId(callbackTask.getToWarehouseId()); request.setToLocationId(callbackTask.getToLocationId()); request.setTransType("移库"); - request.setToStation("*"); // 立库内的站点都为* + request.setToStation(callbackTask.getToStation()); // 立库内的站点都为* // 根据transTypeDesc判断业务类型 if ("入库".equals(callbackTask.getTransTypeDesc())) { @@ -155,11 +156,9 @@ public class WcsTaskServiceImpl implements WcsTaskService { private void updateOrderTaskStatusForInbound(WcsCallbackTask callbackTask) { try { // 查找对应的wms_order_task记录(source_type=组盘入库,pallet_id一致,status=已创建) - List orderTasks = wcsIntegrationMapper.findOrderTasksByPalletAndActionType( - callbackTask.getSite(), - callbackTask.getPalletId(), - "组盘入库", - "已创建" + List orderTasks = wcsIntegrationMapper.findOrderTasksByTaskNo( + callbackTask.getSite(), + callbackTask.getTaskNo() ); if (orderTasks != null && !orderTasks.isEmpty()) { diff --git a/src/main/java/com/gaotao/modules/other/service/impl/InventoryMoveServiceImpl.java b/src/main/java/com/gaotao/modules/other/service/impl/InventoryMoveServiceImpl.java index e42b696..006f560 100644 --- a/src/main/java/com/gaotao/modules/other/service/impl/InventoryMoveServiceImpl.java +++ b/src/main/java/com/gaotao/modules/other/service/impl/InventoryMoveServiceImpl.java @@ -64,6 +64,7 @@ public class InventoryMoveServiceImpl implements InventoryMoveService { @Value("${custom.ifs-domainUserID}") private String domainUserID; + //-----别改-------- @Override @Transactional public void confirmInventoryMove(InventoryMoveRequestDto dto) { diff --git a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml index 8f421d8..55b1a5d 100644 --- a/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml +++ b/src/main/resources/mapper/automatedWarehouse/WcsIntegrationMapper.xml @@ -519,7 +519,7 @@ to_warehouse_id as toWarehouseId, to_location_id as toLocationId, status, created_time as createdTime, process_start_time as processStartTime, process_end_time as processEndTime, error_msg as errorMsg, - retry_count as retryCount, remark + retry_count as retryCount, remark,task_no,item_no,to_station from wcs_callback_task where site = #{site} and status in ('已录入', '处理失败') and (retry_count is null or 3>retry_count ) @@ -569,6 +569,21 @@ and status = #{status} order by created_time desc +