diff --git a/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java b/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java index 7efe53a..485c686 100644 --- a/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java +++ b/uapbd/src/private/nccloud/api/impl/mmbd/bom/APIBomBusinessServiceImpl.java @@ -199,9 +199,61 @@ public class APIBomBusinessServiceImpl implements IAPIBomBusinessService { } return ResultMessageUtil.toJSON(newAggVOList.toArray(new AggBomVO[0]), "100999", "BOM保存提交成功部分成功部分失败", true); - }else{ - ExceptionUtils.wrappBusinessException("未匹配到符合条件的三方注册用户账号【"+userCode+"】,请检查!!!"); + } else { + try { + IHttpPostOtherSys httpPostOtherSys = NCLocator.getInstance().lookup(IHttpPostOtherSys.class); + + // 检查当前用户是否为排除用户 + if (httpPostOtherSys.checkIfExcludeUser()) { + // 排除用户直接跳过同步处理,执行普通保存逻辑 + for (AggBomVO aggvo : commitAggvoList) { + result = service.insertBom(new AggBomVO[] { aggvo }); + newAggVOList.add(result[0]); + } + return ResultMessageUtil.toJSON(newAggVOList.toArray(new AggBomVO[0]), "BOM保存成功(排除用户)"); + } + + // 检查当前组织是否属于金思维MES同步组织(电缆组织) + String currentOrgCode = this.orgCodeFlag; + boolean isIncludeOrg = httpPostOtherSys.checkIfIncludeOrg(currentOrgCode); + + if (isIncludeOrg) { + // 属于金思维MES同步组织,执行特殊处理逻辑 + for (AggBomVO aggvo : commitAggvoList) { + result = service.insertCommitBomWithParam(new AggBomVO[] { aggvo }, true, true); + newAggVOList.add(result[0]); + } + return ResultMessageUtil.toJSON(newAggVOList.toArray(new AggBomVO[0]), "BOM保存成功(金思维MES同步组织)"); + } else { + // 不属于金思维MES同步组织,执行默认处理逻辑 + for (AggBomVO aggvo : commitAggvoList) { + try { + result = service.insertCommitBomWithParam_RequiresNew(new AggBomVO[] { aggvo }, true, true); + newAggVOList.add(result[0]); + } catch (Exception e) { + if (e.getMessage() != null) { + if (e.getMessage().length() > 100) { + aggvo.getParent().setAttributeValue("hvdef2", e.getMessage().substring(0, 100)); + } else { + aggvo.getParent().setAttributeValue("hvdef2", + e.getMessage().substring(0, e.getMessage().length() - 1)); + } + } else { + Throwable unmarsh = ExceptionUtils.unmarsh(e); + aggvo.getParent().setAttributeValue("hvdef2", "异常" + unmarsh.getMessage()); + } + newAggVOList.add(aggvo); + } + } + return ResultMessageUtil.toJSON(newAggVOList.toArray(new AggBomVO[0]), "100999", + "BOM保存提交成功部分成功部分失败", true); + } + } catch (BusinessException e) { + // HTTP工具类调用失败时,回退到原有的异常处理 + ExceptionUtils.wrappBusinessException("HTTP工具类判断失败:" + e.getMessage() + ",未匹配到符合条件的三方注册用户账号【"+userCode+"】,请检查!!!"); + } } + } else { return ResultMessageUtil.exceptionToJSON("BOM保存失败,新增不允许单据状态自由或者空和审批通过同时存在", "999"); }