From a26fbbc9580fc9748c5887c21e2296c13516d8ee 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, 14 Oct 2026 19:24:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=BA=E5=88=B6=E7=BD=AE=E7=A9=BA=E6=89=98?= =?UTF-8?q?=E7=9B=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HaiAnPdaAutoWarehouseController.java | 7 ++-- .../pda/HaiAnForceRemovePalletResult.java | 16 ++++++++++ .../service/HaiAnPdaAutoWarehouseService.java | 5 +-- .../HaiAnPdaAutoWarehouseServiceImpl.java | 32 +++++++++++++++++-- .../mapper/check/PhysicalInventoryMapper.xml | 2 +- 5 files changed, 54 insertions(+), 8 deletions(-) create mode 100644 src/main/java/com/gaotao/modules/autoWareHourceHaian/entity/pda/HaiAnForceRemovePalletResult.java diff --git a/src/main/java/com/gaotao/modules/autoWareHourceHaian/controller/HaiAnPdaAutoWarehouseController.java b/src/main/java/com/gaotao/modules/autoWareHourceHaian/controller/HaiAnPdaAutoWarehouseController.java index e18ed3cc..2b4adf18 100644 --- a/src/main/java/com/gaotao/modules/autoWareHourceHaian/controller/HaiAnPdaAutoWarehouseController.java +++ b/src/main/java/com/gaotao/modules/autoWareHourceHaian/controller/HaiAnPdaAutoWarehouseController.java @@ -12,6 +12,7 @@ import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletListRow; import com.gaotao.modules.autoWareHourceHaian.entity.HaiAnPalletTransferEnqueueResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletMergeResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletRelocateScanResult; +import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnForceRemovePalletResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletSpecialEditResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletReservedResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletScanResult; @@ -609,13 +610,13 @@ public class HaiAnPdaAutoWarehouseController { } /** - * 强制置空托盘区域、位置和货架点位,同时将任务标记置N;仅接收site与palletId,货架占用由服务校验 - rqrq + * 强制置空托盘区域、位置和货架点位,同时将任务标记置N;本地成功后同步立库,同步结果放在row.wcsSyncSuccess,失败不回滚 - rqrq */ @PostMapping("/forceRemovePalletSpecialEdit") public R forceRemovePalletSpecialEdit(@RequestBody HaiAnPdaRequest params) { // 调用海安PDA服务按site和托盘编码置空位置并释放任务标记;货架占用或更新失败时服务回滚并提示 - rqrq - haiAnPdaAutoWarehouseService.forceRemovePalletSpecialEdit(params); - return R.ok().put("msg", "强制置空托盘成功"); + HaiAnForceRemovePalletResult row = haiAnPdaAutoWarehouseService.forceRemovePalletSpecialEdit(params); + return R.ok().put("row", row).put("msg", "强制置空托盘成功"); } /** diff --git a/src/main/java/com/gaotao/modules/autoWareHourceHaian/entity/pda/HaiAnForceRemovePalletResult.java b/src/main/java/com/gaotao/modules/autoWareHourceHaian/entity/pda/HaiAnForceRemovePalletResult.java new file mode 100644 index 00000000..5b2244d6 --- /dev/null +++ b/src/main/java/com/gaotao/modules/autoWareHourceHaian/entity/pda/HaiAnForceRemovePalletResult.java @@ -0,0 +1,16 @@ +package com.gaotao.modules.autoWareHourceHaian.entity.pda; + +import lombok.Data; + +/** + * @author rqrq + * @Description 海安PDA强制置空托盘结果:本地置空已成功,wcsSyncSuccess只表示立库errorPalletRefresh是否成功 - rqrq + */ +@Data +public class HaiAnForceRemovePalletResult { + + /** + * 立库同步是否成功。true=errorPalletRefresh成功;false=立库同步失败,本地置空不回滚。不落库。 - rqrq + */ + private Boolean wcsSyncSuccess; +} diff --git a/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/HaiAnPdaAutoWarehouseService.java b/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/HaiAnPdaAutoWarehouseService.java index 2a59c902..6ff19244 100644 --- a/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/HaiAnPdaAutoWarehouseService.java +++ b/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/HaiAnPdaAutoWarehouseService.java @@ -11,6 +11,7 @@ import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletListRow; import com.gaotao.modules.autoWareHourceHaian.entity.HaiAnPalletTransferEnqueueResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletMergeResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletRelocateScanResult; +import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnForceRemovePalletResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletSpecialEditResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletReservedResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletScanResult; @@ -343,9 +344,9 @@ public interface HaiAnPdaAutoWarehouseService { void savePalletSpecialEdit(HaiAnPdaRequest request); /** - * 强制置空非立库托盘的区域、位置及货架点位,调用标记置N并清空备注;请求须包含site和palletId,货架占用时拒绝 - rqrq + * 强制置空非立库托盘的区域、位置及货架点位,调用标记置N并清空备注;完成后先把明细wcs_flag 0改1,再调用立库errorPalletRefresh,同步失败不回滚本地置空 - rqrq */ - void forceRemovePalletSpecialEdit(HaiAnPdaRequest request); + HaiAnForceRemovePalletResult forceRemovePalletSpecialEdit(HaiAnPdaRequest request); /** * @author rqrq diff --git a/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnPdaAutoWarehouseServiceImpl.java b/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnPdaAutoWarehouseServiceImpl.java index 676f5cad..52bbb59d 100644 --- a/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnPdaAutoWarehouseServiceImpl.java +++ b/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnPdaAutoWarehouseServiceImpl.java @@ -10,6 +10,7 @@ import com.gaotao.modules.autoWareHourceHaian.api.entity.HaiAnCheckInventoryExis import com.gaotao.modules.autoWareHourceHaian.api.entity.HaiAnDirectMaterialCallRequest; import com.gaotao.modules.autoWareHourceHaian.api.entity.HaiAnGroundLocationQueryRequest; import com.gaotao.modules.autoWareHourceHaian.api.entity.HaiAnGroundLocationStatusUpdateRequest; +import com.gaotao.modules.autoWareHourceHaian.api.entity.HaiAnErrorPalletRefreshRequest; import com.gaotao.modules.autoWareHourceHaian.api.entity.HaiAnOutsideTransferTaskRequest; import com.gaotao.modules.autoWareHourceHaian.api.entity.HaiAnSpecialPalletTask; import com.gaotao.modules.autoWareHourceHaian.api.service.HaiAnWcsApiService; @@ -32,6 +33,7 @@ import com.gaotao.modules.autoWareHourceHaian.entity.HaiAnPalletTransferEnqueueR import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletMergeResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletRelocateMismatchRow; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletRelocateScanResult; +import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnForceRemovePalletResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletSpecialEditResult; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletReservedLabelRow; import com.gaotao.modules.autoWareHourceHaian.entity.pda.HaiAnPalletReservedResult; @@ -3894,11 +3896,11 @@ public class HaiAnPdaAutoWarehouseServiceImpl implements HaiAnPdaAutoWarehouseSe } /** - * 强制置空托盘清空区域、位置、货架点位和占用备注,并把calling_flag置N;立库货架占用或审计失败时事务回滚 - rqrq + * 强制置空托盘清空区域、位置、货架点位和占用备注,并把calling_flag置N;立库货架占用或审计失败时事务回滚。本地完成后先把明细wcs_flag 0改1,再调用立库重置,同步失败只记结果不回滚。 - rqrq */ @Override @Transactional(rollbackFor = Exception.class) - public void forceRemovePalletSpecialEdit(HaiAnPdaRequest request) { + public HaiAnForceRemovePalletResult forceRemovePalletSpecialEdit(HaiAnPdaRequest request) { String site = requireSite(request); guardSite54(site); String palletId = normalizePalletId(request.getPalletId()); @@ -3944,6 +3946,32 @@ public class HaiAnPdaAutoWarehouseServiceImpl implements HaiAnPdaAutoWarehouseSe throw new RuntimeException("强制置空托盘状态日志写入失败,操作已回滚"); } log.info("海安托盘强制置空成功:site={}, palletId={}", site, palletId); + // 立库重置前先把本托已提交明细改回待推送;只改wcs_flag=0,没有明细时0行也算完成 - rqrq + haiAnPdaAutoWarehouseMapper.reUpdatePalletDetailWcsFlag(site, palletId); + // 本地置空已经完成,再用置空前的地面位置通知立库双方重置;失败只回传同步结果,禁止把已置空的托盘回滚 - rqrq + HaiAnForceRemovePalletResult result = new HaiAnForceRemovePalletResult(); + result.setWcsSyncSuccess(syncErrorPalletRefreshAfterForceRemove(site, palletId, pallet.getLocationCode())); + return result; + } + + /** + * @author rqrq + * @Description 强制置空后调用立库errorPalletRefresh;任何失败都视为同步失败并返回false,不向上抛,避免本地置空回滚 - rqrq + */ + private boolean syncErrorPalletRefreshAfterForceRemove(String site, String palletId, String locationCode) { + try { + HaiAnErrorPalletRefreshRequest refreshRequest = new HaiAnErrorPalletRefreshRequest(); + refreshRequest.setSite(site); + refreshRequest.setPalletId(palletId); + refreshRequest.setLocationCode(locationCode); + haiAnWcsApiService.errorPalletRefresh(refreshRequest); + log.info("强制置空后立库同步成功:site={}, palletId={}, locationCode={} - rqrq", site, palletId, locationCode); + return true; + } catch (Exception e) { + log.error("强制置空后立库同步失败,本地置空不回滚:site={}, palletId={}, locationCode={}, err={} - rqrq", + site, palletId, locationCode, e.getMessage()); + return false; + } } /** diff --git a/src/main/resources/mapper/check/PhysicalInventoryMapper.xml b/src/main/resources/mapper/check/PhysicalInventoryMapper.xml index bca9d9aa..bb41c8df 100644 --- a/src/main/resources/mapper/check/PhysicalInventoryMapper.xml +++ b/src/main/resources/mapper/check/PhysicalInventoryMapper.xml @@ -1050,7 +1050,7 @@ LEFT JOIN pallet_detail b ON h.unit_id = b.serial_no AND h.site = b.site LEFT JOIN pallet p ON b.pallet_id = p.pallet_id AND b.site = p.site LEFT JOIN agv_station s ON p.location_code = s.station_code - WHERE h.site = #{query.site} AND p.pallet_id IS NOT NULL and p.wcs_location is not null + WHERE h.site = #{query.site} AND p.pallet_id IS NOT NULL and (p.wcs_location is not null or p.location_code ='Virtual_AS') AND h.part_no LIKE #{query.searchPartNo}