From 2bad51cefa131f658d6174e4994579e18d29203a Mon Sep 17 00:00:00 2001 From: tangfutang Date: Tue, 4 Sep 2018 21:00:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=95=E4=BA=BA=E5=AE=A2=E6=88=B7=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E6=97=B6=E7=BC=96=E5=8F=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Company/CustomerCompanyRegister.jsp | 10 +++--- .../company/NewCustomerCompanyController.java | 35 ++++++++++++------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompanyRegister.jsp b/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompanyRegister.jsp index ddf6a2258..15d9037fb 100644 --- a/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompanyRegister.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Company/CustomerCompanyRegister.jsp @@ -60,18 +60,20 @@ include file="/Frame/resources/include/ui/include_info.jspf"%> if(!iV_all("0")) return; if(!checkCertInfo(true)) return ;//检查证件格式 var custNum = getItemValue(0,getRow(),"CUSTOMER_NUM"); - if(custNum==null||custNum==""){ + /* if(custNum==null||custNum==""){ setErrorTips("CUSTOMER_NUM","请先客商编码!"); return; - } + } */ var certType=getItemValue(0,getRow(),"certtype"); var certId=getItemValue(0,getRow(),"certid"); var nationCode=getItemValue(0,getRow(),"nationcode"); var customerName=getItemValue(0,getRow(),"customername"); var status=getItemValue(0,getRow(),"status"); - var sParams = "customernum="+custNum+",certType="+certType+",certId="+certId+",nationCode="+nationCode+",status="+status+",customerType=<%=customerType%>,customerName="+customerName+",userId=<%=CurUser.getUserID()%>,orgId=<%=CurUser.getOrgID()%>"; + var sParams = "certType="+certType+",certId="+certId+",nationCode="+nationCode+",status="+status+",customerType=<%=customerType%>,customerName="+customerName+",userId=<%=CurUser.getUserID()%>,orgId=<%=CurUser.getOrgID()%>"; var message=RunJavaMethodTrans("com.tenwa.customer.controller.company.NewCustomerCompanyController","checkCustomerNum",sParams); - if(message!="SUCCESS"){ + if(message.indexOf("@")>0){ + sParams=sParams+",customernum="+message.split("@")[1]; + }else if(message!="SUCCESS"){ alert(message); return; } diff --git a/src_tenwa/com/tenwa/customer/controller/company/NewCustomerCompanyController.java b/src_tenwa/com/tenwa/customer/controller/company/NewCustomerCompanyController.java index b4ba8aa2a..ee74dd43b 100644 --- a/src_tenwa/com/tenwa/customer/controller/company/NewCustomerCompanyController.java +++ b/src_tenwa/com/tenwa/customer/controller/company/NewCustomerCompanyController.java @@ -160,17 +160,10 @@ public class NewCustomerCompanyController{ return "FAIl@客户证件号码\""+certId+"\"在"+certfrom+"中已注册,不能重复注册!"; }else{ - //获取编码规则 - String serinum=FlowUtil.getCustomer_Id(tx); - String serin=""; - if(serinum.length()<15){ - for(int i=0;i<15-serinum.length();i++){ - serin+="0"; - } - } + //新增客户 BizObject newCustomer = custManager.newObject(); - newCustomer.setAttributeValue("customerid", "APZLC"+serin+serinum); +// newCustomer.setAttributeValue("customerid", "APZLC"+serin+serinum); newCustomer.setAttributeValue("nationcode", nationCode); newCustomer.setAttributeValue("customername", customerName); newCustomer.setAttributeValue("certtype", certType); @@ -178,7 +171,19 @@ public class NewCustomerCompanyController{ newCustomer.setAttributeValue("customertype", customerType); newCustomer.setAttributeValue("inputuserid", userId); newCustomer.setAttributeValue("inputorgid", orgId); - newCustomer.setAttributeValue("customer_num", customernum); + if(customernum!="" && customernum!=null && customernum.length()>0){ + newCustomer.setAttributeValue("customer_num", customernum); + }else{ + //获取编码规则 + String serinum=FlowUtil.getCustomer_Id(tx); + String serin=""; + if(serinum.length()<15){ + for(int i=0;i<15-serinum.length();i++){ + serin+="0"; + } + } + newCustomer.setAttributeValue("customer_num", "APZLC"+serin+serinum); + } newCustomer.setAttributeValue("inputtime", DateAssistant.getTodayNow()); custManager.saveObject(newCustomer); if(!((certType==null||"".equals(certType))||((certId==null||"".equals(certId))))){ @@ -238,9 +243,15 @@ public class NewCustomerCompanyController{ } public String checkCustomerNum(JBOTransaction tx)throws Exception { BizObjectManager custManager =JBOFactory.getFactory().getManager("jbo.app.tenwa.customer.CUSTOMER_INFO"); - BizObject cus = custManager.createQuery("customer_num=:customenum").setParameter("customenum", customernum).getSingleResult(false); + BizObjectManager cltManager =JBOFactory.getFactory().getManager("jbo.app.tenwa.customer.CUSTOMER_LIST"); + BizObject cus = custManager.createQuery("customername=:customername").setParameter("customername", customerName).getSingleResult(false); if(cus!=null){ - return "客商编码已存在,请重新选择或填写!!!"; + return "客户名称已存在,请重新选择或填写!!!"; + }else{ + BizObject cl = cltManager.createQuery("cust_name=:custname").setParameter("custname", customerName).getSingleResult(false); + if(cl!=null){ + return "customernum@"+cl.getAttribute("cust_id").getString(); + } } return "SUCCESS"; }