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 f715df66..02868428 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 @@ -21,6 +21,7 @@ import com.gaotao.modules.handlingunit.entity.HandlingUnit; import com.gaotao.modules.handlingunit.service.HandlingUnitService; import com.gaotao.modules.trans.entity.*; import com.gaotao.modules.trans.service.*; +import com.gaotao.modules.warehouse.dao.PalletMapper; import com.gaotao.modules.warehouse.entity.InventoryStock; import com.gaotao.modules.warehouse.entity.Pallet; import com.gaotao.modules.warehouse.service.InventoryStockService; @@ -65,6 +66,8 @@ public class WmsMessageServiceImpl implements WmsMessageService { @Autowired private PalletService palletService; + @Autowired + private PalletMapper palletMapper; @Autowired private WcsIntegrationService wcsIntegrationService; @@ -379,8 +382,22 @@ public class WmsMessageServiceImpl implements WmsMessageService { throw new RuntimeException("托盘不存在:" + inData.getPalletId()); } + // 更新托盘位置和调用标志 - rqrq + log.info("取货通知-更新托盘信息前 - rqrq,托盘ID: {}, 主键ID: {}, 当前位置: {}, 当前调用标志: {}, 目标位置: {}", + pallet.getPalletId(), pallet.getId(), pallet.getLocationCode(), pallet.getCallingFlag(), inData.getToBarcode()); + pallet.setLocationCode(inData.getToBarcode()); - palletService.updateById(pallet); + pallet.setCallingFlag("N"); + // boolean updateResult = palletService.updateById(pallet); + palletMapper.updateLocationWithPalletId(pallet.getSite(),pallet.getPalletId(),pallet.getLocationCode(),null); + + // log.info("取货通知-更新托盘信息完成 - rqrq,托盘ID: {}, 主键ID: {}, 更新结果: {}, 新位置: {}, 新调用标志: N", + // pallet.getPalletId(), pallet.getId(), updateResult ? "成功" : "失败", inData.getToBarcode()); + // + // if (!updateResult) { + // throw new RuntimeException("更新托盘信息失败,托盘ID: " + inData.getPalletId()); + // } + // 4. 保存WCS回调数据到新表,作为记录 后续根据order表去取货就行 WcsCallbackTask callbackTask = new WcsCallbackTask(); callbackTask.setSite(inData.getSite()); @@ -498,7 +515,8 @@ public class WmsMessageServiceImpl implements WmsMessageService { } pallet.setLocationCode(request.getToStation()); pallet.setWcsLocation(request.getToStation()); - palletService.updateById(pallet); + + palletMapper.updateLocationWithPalletId(pallet.getSite(),pallet.getPalletId(),pallet.getLocationCode(),pallet.getWcsLocation()); //如果更新wcs库位 //这里插入逻辑 diff --git a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AgvTaskServiceImpl.java b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AgvTaskServiceImpl.java index 7769fc2b..8d4a74d4 100644 --- a/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AgvTaskServiceImpl.java +++ b/src/main/java/com/gaotao/modules/automatedWarehouse/service/impl/AgvTaskServiceImpl.java @@ -19,6 +19,7 @@ import com.gaotao.modules.automatedWarehouse.mapper.AgvTaskMapper; import com.gaotao.modules.automatedWarehouse.mapper.WcsIntegrationMapper; import com.gaotao.modules.automatedWarehouse.service.AgvTaskService; import com.gaotao.modules.base.entity.PalletType; +import com.gaotao.modules.warehouse.dao.PalletMapper; import com.gaotao.modules.warehouse.entity.Pallet; import com.gaotao.modules.warehouse.service.PalletService; import lombok.extern.slf4j.Slf4j; @@ -37,7 +38,8 @@ public class AgvTaskServiceImpl implements AgvTaskService { @Autowired private AgvTaskMapper agvTaskMapper; - + @Autowired + private PalletMapper palletMapper; @Autowired private AgvClientUtil agvClientUtil; @Autowired @@ -402,8 +404,8 @@ public class AgvTaskServiceImpl implements AgvTaskService { // 更新栈板位置信息(复用doWareHouseForPallet中的逻辑) pallet.setLocationCode(transportTask.getToLocation()); - palletService.updateById(pallet); - + // palletService.updateById(pallet); + palletMapper.updateLocationWithPalletId(pallet.getSite(),pallet.getPalletId(),pallet.getLocationCode(),pallet.getWcsLocation()); log.info("栈板{}位置已更新到目标站点{}", transportTask.getPalletId(), transportTask.getToLocation()); } catch (Exception e) { diff --git a/src/main/java/com/gaotao/modules/warehouse/dao/PalletMapper.java b/src/main/java/com/gaotao/modules/warehouse/dao/PalletMapper.java index 263081ff..fcdec430 100644 --- a/src/main/java/com/gaotao/modules/warehouse/dao/PalletMapper.java +++ b/src/main/java/com/gaotao/modules/warehouse/dao/PalletMapper.java @@ -33,4 +33,7 @@ public interface PalletMapper extends BaseMapper { * @date 2025/10/14 */ PalletData selectPalletByPalletId(@Param("palletId") String palletId); + + void updateLocationWithPalletId(@Param("site") String site,@Param("palletId") String palletId,@Param("locationCode") String locationCode,@Param("wcsLocation") String wcsLocation); + } diff --git a/src/main/java/com/gaotao/modules/warehouse/service/PalletService.java b/src/main/java/com/gaotao/modules/warehouse/service/PalletService.java index 7bac219c..781cee1e 100644 --- a/src/main/java/com/gaotao/modules/warehouse/service/PalletService.java +++ b/src/main/java/com/gaotao/modules/warehouse/service/PalletService.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.gaotao.common.utils.PageUtils; import com.gaotao.modules.warehouse.entity.Pallet; import com.gaotao.modules.warehouse.entity.PalletData; +import org.apache.ibatis.annotations.Param; /** * @Description 托盘服务接口 - rqrq @@ -75,4 +76,5 @@ public interface PalletService extends IService { * @date 2025/10/14 */ boolean checkPalletIdExists(String palletId, Long excludeId); -} + + } diff --git a/src/main/resources/mapper/warehouse/PalletMapper.xml b/src/main/resources/mapper/warehouse/PalletMapper.xml index fa880715..11a11f4e 100644 --- a/src/main/resources/mapper/warehouse/PalletMapper.xml +++ b/src/main/resources/mapper/warehouse/PalletMapper.xml @@ -103,4 +103,7 @@ WHERE p.pallet_id = #{palletId} + + update pallet set location_code=#{locationCode} ,wcs_location=#{wcsLocation} where site=#{site} and pallet_id=#{palletId} +