diff --git a/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnIssueNotifyPushTransactionServiceImpl.java b/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnIssueNotifyPushTransactionServiceImpl.java index aa18dc2f..0ca2806a 100644 --- a/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnIssueNotifyPushTransactionServiceImpl.java +++ b/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnIssueNotifyPushTransactionServiceImpl.java @@ -70,11 +70,11 @@ public class HaiAnIssueNotifyPushTransactionServiceImpl implements HaiAnIssueNot throw new RuntimeException("订单没有服务端匹配明细,无法推送"); } - // 重新读取主单,确认site、申请单和ISSUE状态仍然有效,避免预览到确认期间状态发生变化 - rqrq + // 重新读取主单,确认site、申请单、类型白名单和ISSUE状态仍然有效,避免预览到确认期间状态发生变化 - rqrq com.gaotao.modules.autoWareHourceHaian.entity.HaiAnSOIssueNotifyHeaderData header = haiAnSearchIssureNotifyMapper.haiAnGetNotifyHeader(site, notifyNo); - if (header == null || !"noorder".equalsIgnoreCase(StringUtils.defaultString(header.getOrderType()).trim())) { - throw new RuntimeException("申请单不存在或不是海安无订单申请单"); + if (header == null || !isIssueWcsPushOrderType(header.getOrderType())) { + throw new RuntimeException("申请单不存在或该海安申请类型暂未开放推送WCS"); } if (!"ISSUE".equalsIgnoreCase(StringUtils.defaultString(header.getStatus()).trim())) { throw new RuntimeException("申请单不是ISSUE状态,不能推送WCS"); @@ -276,6 +276,18 @@ public class HaiAnIssueNotifyPushTransactionServiceImpl implements HaiAnIssueNot return result; } + /** + * @author rqrq + * @Description 事务层再次限制可真实推送WCS的海安查看页类型,防止绕过预览接口直接调用确认接口导致未验证类型下发 - rqrq + */ + private boolean isIssueWcsPushOrderType(String orderType) { + String normalizedOrderType = StringUtils.defaultString(orderType).trim().toLowerCase(); + return "noorder".equals(normalizedOrderType) + || "shoporder".equals(normalizedOrderType) + || "poorder".equals(normalizedOrderType) + || "shipment".equals(normalizedOrderType); + } + /** * @author rqrq * @Description 按托盘和位置层构造稳定的WCS物料列表,同时确保一个标签只出现在一次报文中 - rqrq diff --git a/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnSearchIssureNotifyServiceImpl.java b/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnSearchIssureNotifyServiceImpl.java index 66c3d0c3..55931d88 100644 --- a/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnSearchIssureNotifyServiceImpl.java +++ b/src/main/java/com/gaotao/modules/autoWareHourceHaian/service/impl/HaiAnSearchIssureNotifyServiceImpl.java @@ -253,7 +253,7 @@ public class HaiAnSearchIssureNotifyServiceImpl implements HaiAnSearchIssureNoti if (header == null) { throw new RuntimeException("海安申请单不存在或不属于当前site"); } - if (!"noorder".equalsIgnoreCase(StringUtils.defaultString(header.getOrderType()).trim())) { + if (!isIssueWcsPushOrderType(header.getOrderType())) { return buildPlaceholderMatchResponse(data.getSite(), data.getNotifyNo(), "该海安页面暂不执行真实库存匹配"); } if (!"ISSUE".equalsIgnoreCase(StringUtils.defaultString(header.getStatus()).trim())) { @@ -288,12 +288,12 @@ public class HaiAnSearchIssureNotifyServiceImpl implements HaiAnSearchIssureNoti String site = data.getSite().trim(); String notifyNo = data.getNotifyNo().trim(); - // 查询主单并再次校验海安无订单类型和ISSUE状态,禁止从其他页面误触发真实推送 - rqrq + // 查询主单并再次校验海安可推送申请类型和ISSUE状态,禁止未开放类型误触发真实推送 - rqrq HaiAnSOIssueNotifyHeaderData header = haiAnSearchIssureNotifyMapper.haiAnGetNotifyHeader(site, notifyNo); if (header == null) { throw new RuntimeException("海安申请单不存在或不属于当前site"); } - if (!"noorder".equalsIgnoreCase(StringUtils.defaultString(header.getOrderType()).trim())) { + if (!isIssueWcsPushOrderType(header.getOrderType())) { HaiAnWcsPushResult placeholder = new HaiAnWcsPushResult(); placeholder.setPlaceholder(true); placeholder.setNotifyPushWcsFlag(header.getPushWcsFlag()); @@ -551,6 +551,9 @@ public class HaiAnSearchIssureNotifyServiceImpl implements HaiAnSearchIssureNoti } } + // 将目标区域、已推送、共享托盘等订单级失败挂回物料汇总行,否则页面只看到数量满足但看不到按钮禁用原因 - rqrq + applyOrderFailureToMaterialRow(materialRow, summary.getItemNo(), sourceRows); + materialRow.setMatchedSerialNos(joinSerialNos(materialSerialNos)); compactRows.add(materialRow); for (Map.Entry entry : specifiedRows.entrySet()) { @@ -561,6 +564,31 @@ public class HaiAnSearchIssureNotifyServiceImpl implements HaiAnSearchIssureNoti return compactRows; } + /** + * @author rqrq + * @Description 从同一订单序号的失败事件中提取首个阻断原因,回填到物料汇总行供前端解释不可推送状态 - rqrq + */ + private void applyOrderFailureToMaterialRow(HaiAnInventoryMatchResult materialRow, BigDecimal itemNo, + List sourceRows) { + if (materialRow == null || itemNo == null || sourceRows == null || StringUtils.isNotBlank(materialRow.getFailureCode())) { + return; + } + for (HaiAnInventoryMatchResult event : sourceRows) { + if (event == null || event.getItemNo() == null || itemNo.compareTo(event.getItemNo()) != 0) { + continue; + } + if (!"FAILED".equalsIgnoreCase(StringUtils.defaultString(event.getMatchStatus()).trim()) + || StringUtils.isBlank(event.getFailureCode())) { + continue; + } + materialRow.setMatchStatus("FAILED"); + materialRow.setFailureCode(event.getFailureCode()); + materialRow.setFailureMessage(event.getFailureMessage()); + materialRow.setOrderSatisfactionStatus("INCOMPLETE"); + return; + } + } + /** * @author rqrq * @Description 复制前端预览需要的物料字段,明确排除托盘、位置、批次日期等推送内部字段 - rqrq @@ -751,7 +779,7 @@ public class HaiAnSearchIssureNotifyServiceImpl implements HaiAnSearchIssureNoti /** * @author rqrq - * @Description 生成非无订单海安页面的兼容占位返回,不触发通用匹配过程 - rqrq + * @Description 生成未开放类型的兼容占位返回,不触发通用匹配过程和WCS副作用 - rqrq */ private HaiAnInventoryMatchResponse buildPlaceholderMatchResponse(String site, String notifyNo, String message) { HaiAnInventoryMatchResponse response = new HaiAnInventoryMatchResponse(); @@ -762,6 +790,18 @@ public class HaiAnSearchIssureNotifyServiceImpl implements HaiAnSearchIssureNoti return response; } + /** + * @author rqrq + * @Description 判断海安查看页申请类型是否已开放真实WCS库存匹配和确认推送;未开放类型保持占位返回,避免报废等未知链路误下发WCS - rqrq + */ + private boolean isIssueWcsPushOrderType(String orderType) { + String normalizedOrderType = StringUtils.defaultString(orderType).trim().toLowerCase(); + return "noorder".equals(normalizedOrderType) + || "shoporder".equals(normalizedOrderType) + || "poorder".equals(normalizedOrderType) + || "shipment".equals(normalizedOrderType); + } + /** * @author rqrq * @Description 生成订单级推送结果摘要,明确本次成功和跳过数量 - rqrq diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 90165144..fe2ae218 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -157,7 +157,7 @@ scheduler: ifsPalletMoveQueue: processing-timeout-minutes: 10 # 自动化托运IFS移库队列P状态超时回收分钟数 - rqrq haianAutoTask: - enabled: true # 海安非归档自动任务总开关:控制HaianAutoTaskScheduler与HaianWcsSchedule全部定时任务;归档仍走haianDataArchive.enabled - rqrq + enabled: false # 海安非归档自动任务总开关:控制HaianAutoTaskScheduler与HaianWcsSchedule全部定时任务;归档仍走haianDataArchive.enabled - rqrq kit-transport-fixed-delay-ms: 10000 # 海安齐套transport_flag回写任务间隔(毫秒),默认10秒 - rqrq ifsPalletMoveQueue: processing-timeout-minutes: 10 # 海安IFS移库队列P状态超时回收分钟数 - rqrq