From d0efcf69d31e873dcc0148c3dd4224e199239e60 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: Fri, 28 Aug 2026 10:39:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=88=E6=89=98OK?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HaiAnPdaAutoWarehouseServiceImpl.java | 66 +++++++++++++++---- 1 file changed, 52 insertions(+), 14 deletions(-) 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 5b9fe305..a45bd122 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 @@ -497,10 +497,37 @@ public class HaiAnPdaAutoWarehouseServiceImpl implements HaiAnPdaAutoWarehouseSe HaiAnAreaOption areaInfo = haiAnPdaAutoWarehouseMapper.getHaianArea(site, areaId); String packAble = areaInfo == null ? "" : areaInfo.getPackAble(); if ("N".equalsIgnoreCase(packAble)) { - throw new RuntimeException("该区域禁止盘标签操作"); + throw new RuntimeException("该区域禁止扫标签操作"); } } + /** + * @author rqrq + * @Description 移出全部物料/合托前校验托盘组盘权限:离站托盘(area+location均空)放行,否则必须满足area.pack_able=Y - rqrq + */ + private void validatePackAbleForBulkPalletOperation(String site, HaiAnPalletInfoResult palletInfo) { + if (palletInfo == null) { + throw new RuntimeException("栈板不存在"); + } + String areaId = StringUtils.hasText(palletInfo.getArea()) ? palletInfo.getArea().trim() : ""; + String locationCode = StringUtils.hasText(palletInfo.getLocationCode()) ? palletInfo.getLocationCode().trim() : ""; + boolean areaBlank = !StringUtils.hasText(areaId); + boolean locationBlank = !StringUtils.hasText(locationCode); + // 托盘不在站点上(area与location同时为空)时允许继续,符合“外部托盘/离站托盘可操作”规则 - rqrq + if (areaBlank && locationBlank) { + return; + } + // 其余场景必须通过区域pack_able校验,避免在禁组盘区域执行批量移出或合托 - rqrq + if (!areaBlank) { + HaiAnAreaOption areaInfo = haiAnPdaAutoWarehouseMapper.getHaianArea(site, areaId); + String packAble = areaInfo == null ? "" : areaInfo.getPackAble(); + if ("Y".equalsIgnoreCase(packAble)) { + return; + } + } + throw new RuntimeException("托盘所在区域不允许组盘"); + } + /** * @author rqrq * @Description 托盘换站扫描前校验是否允许移动:必须绑定area且remove_able=Y,否则直接拦截 - rqrq @@ -2072,6 +2099,9 @@ public class HaiAnPdaAutoWarehouseServiceImpl implements HaiAnPdaAutoWarehouseSe if (!StringUtils.hasText(palletId)) { throw new RuntimeException("栈板编码不能为空"); } + HaiAnPalletInfoResult palletInfo = loadRequiredPallet(site, palletId); + // 一键移出前按新规则校验:离站托盘可操作,在站托盘需pack_able=Y - rqrq + validatePackAbleForBulkPalletOperation(site, palletInfo); Integer detailCount = haiAnPdaAutoWarehouseMapper.countPalletDetails(site, palletId); if (detailCount == null || detailCount <= 0) { throw new RuntimeException("栈板无明细数据"); @@ -2123,6 +2153,9 @@ public class HaiAnPdaAutoWarehouseServiceImpl implements HaiAnPdaAutoWarehouseSe if ("Y".equalsIgnoreCase(result.getCallingFlag())) { throw new RuntimeException("托盘正在被调用中,无法进行合托操作"); } + HaiAnPalletInfoResult palletInfo = loadRequiredPallet(site, palletId); + // 合托扫描阶段先校验组盘权限,保证来源/目标托盘都按同一规则拦截 - rqrq + validatePackAbleForBulkPalletOperation(site, palletInfo); List detailRows = haiAnPdaAutoWarehouseMapper.getPalletDetails(site, palletId, null, null); if (detailRows == null || detailRows.isEmpty()) { throw new RuntimeException("托盘没有明细数据,不能作为来源托盘进行合托"); @@ -2206,6 +2239,11 @@ public class HaiAnPdaAutoWarehouseServiceImpl implements HaiAnPdaAutoWarehouseSe if ("Y".equalsIgnoreCase(targetResult.getCallingFlag())) { throw new RuntimeException("目标托盘正在被调用中,无法进行合托操作"); } + HaiAnPalletInfoResult sourcePalletInfo = loadRequiredPallet(site, sourcePalletId); + HaiAnPalletInfoResult targetPalletInfo = loadRequiredPallet(site, targetPalletId); + // 合托提交阶段再次双托盘校验,防止扫描后状态变更绕过权限控制 - rqrq + validatePackAbleForBulkPalletOperation(site, sourcePalletInfo); + validatePackAbleForBulkPalletOperation(site, targetPalletInfo); HaiAnPalletMergeResult targetTypeResult = haiAnPdaAutoWarehouseMapper.checkPalletTypeForMerge(site, targetResult.getPalletType()); if (targetTypeResult == null || !"N".equalsIgnoreCase(targetTypeResult.getWcsAutoSort())) { throw new RuntimeException("目标栈板必须是混装托盘才能合托"); @@ -2215,18 +2253,18 @@ public class HaiAnPdaAutoWarehouseServiceImpl implements HaiAnPdaAutoWarehouseSe if (sourceDetailRows == null || sourceDetailRows.isEmpty()) { throw new RuntimeException("来源托盘没有明细数据,无需合托"); } - List targetDetailRows = haiAnPdaAutoWarehouseMapper.getPalletDetails(site, targetPalletId, null, null); - if (targetDetailRows != null && !targetDetailRows.isEmpty()) { - // 目标托盘已有标签时,来源首条与目标首条标签的库位必须一致,避免跨库位混托 - rqrq - String sourceLocationId = resolveLocationIdForDetail(sourceDetailRows.get(0)); - String targetLocationId = resolveLocationIdForDetail(targetDetailRows.get(0)); - if (sourceLocationId == null && targetLocationId != null) { - throw new RuntimeException("两个托盘的物料所在库位不同,不能合托"); - } - if (sourceLocationId != null && !sourceLocationId.equals(targetLocationId)) { - throw new RuntimeException("两个托盘的物料所在库位不同,不能合托"); - } - } + // List targetDetailRows = haiAnPdaAutoWarehouseMapper.getPalletDetails(site, targetPalletId, null, null); + // if (targetDetailRows != null && !targetDetailRows.isEmpty()) { + // // 目标托盘已有标签时,来源首条与目标首条标签的库位必须一致,避免跨库位混托 - rqrq + // String sourceLocationId = resolveLocationIdForDetail(sourceDetailRows.get(0)); + // String targetLocationId = resolveLocationIdForDetail(targetDetailRows.get(0)); + // if (sourceLocationId == null && targetLocationId != null) { + // throw new RuntimeException("两个托盘的物料所在库位不同,不能合托"); + // } + // if (sourceLocationId != null && !sourceLocationId.equals(targetLocationId)) { + // throw new RuntimeException("两个托盘的物料所在库位不同,不能合托"); + // } + // } String operator = resolveOperator(); haiAnPdaAutoWarehouseMapper.mergePalletDetail(site, sourcePalletId, targetPalletId, operator); @@ -2252,7 +2290,7 @@ public class HaiAnPdaAutoWarehouseServiceImpl implements HaiAnPdaAutoWarehouseSe } refreshPalletEmptyFlag(site, sourcePalletId, operator); refreshPalletEmptyFlag(site, targetPalletId, operator); - // TODO 若后续合托需要触发“栈板移库”链路,请在此补充海安专用移库编排 - rqrq + } @Override