From 2c0d8d6dbc5b45ec41a311ca7308e0f9be1f072b Mon Sep 17 00:00:00 2001 From: tangfutang Date: Tue, 24 Jul 2018 16:23:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=8F=E9=94=80=E5=95=86=E5=88=86=E7=B1=BB?= =?UTF-8?q?=EF=BC=8C=E4=B8=80=E4=B8=AA=E7=BB=8F=E9=94=80=E5=95=86=E5=8F=AA?= =?UTF-8?q?=E8=83=BD=E5=85=B3=E8=81=94=E4=B8=80=E4=B8=AA=E9=9B=86=E5=9B=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DistributorGroupRelationHandler.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src_tenwa/com/tenwa/customer/handler/group/DistributorGroupRelationHandler.java b/src_tenwa/com/tenwa/customer/handler/group/DistributorGroupRelationHandler.java index 5650f2c11..9414621d8 100644 --- a/src_tenwa/com/tenwa/customer/handler/group/DistributorGroupRelationHandler.java +++ b/src_tenwa/com/tenwa/customer/handler/group/DistributorGroupRelationHandler.java @@ -1,5 +1,8 @@ package com.tenwa.customer.handler.group; - import jbo.app.tenwa.customer.CUSTOMER_GROUP_RELATION; + import java.util.List; + +import jbo.app.tenwa.customer.CUSTOMER_GROUP_RELATION; +import jbo.app.tenwa.customer.DISTRIBUTOR_GROUP_COMPANY; import jbo.app.tenwa.customer.DISTRIBUTOR_GROUP_RELATION; import com.amarsoft.are.jbo.BizObject; @@ -23,6 +26,7 @@ import com.amarsoft.awe.dw.handler.impl.CommonHandler; String distributor_id = bo.getAttribute("distributor_id").getString(); String groupId = bo.getAttribute("group_id").getString(); BizObjectManager bom = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_RELATION.CLASS_NAME); + BizObjectManager dgcManage = JBOFactory.getBizObjectManager(DISTRIBUTOR_GROUP_COMPANY.CLASS_NAME); if("".equals(Id)){ BizObject cgr = bom.createQuery("group_id=:group_id and distributor_id=:distributor_id ").setParameter("group_id",groupId).setParameter("distributor_id",distributor_id).getSingleResult(false); @@ -30,7 +34,18 @@ import com.amarsoft.awe.dw.handler.impl.CommonHandler; this.errors="该集团已存在此客户!"; return false; } - }else{ + List cgrList = bom.createQuery("distributor_id=:distributor_id ").setParameter("distributor_id",distributor_id).getResultList(false); + if(cgrList!=null){ + for(BizObject cgrs:cgrList){ + BizObject dgc = dgcManage.createQuery("id=:groupId and tyle='01'").setParameter("groupId", cgrs.getAttribute("group_id").getString()).getSingleResult(false); + if(dgc!=null){ + this.errors="该经销商已存在"+dgc.getAttribute("group_name").getString()+"集团中!"; + return false; + } + } + + } + }else{ BizObject b=bom.createQuery("id=:id").setParameter("id", Id).getSingleResult(false); String bdistributor_id=b.getAttribute("distributor_id").toString(); if(!(bdistributor_id.equals(distributor_id))){